| 1 |
; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s |
| 2 |
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s |
| 3 |
; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -verify-machineinstrs | FileCheck %s |
| 4 |
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -verify-machineinstrs | FileCheck %s |
| 5 |
|
| 6 |
; Verify pre-inc preparation pass doesn't prepare pre-inc for i64 load/store |
| 7 |
; when the stride doesn't conform LDU/STDU DS-form requirement. |
| 8 |
|
| 9 |
@result = local_unnamed_addr global i64 0, align 8 |
| 10 |
|
| 11 |
define i64 @test_preinc_i64_ld(ptr nocapture readonly, i64) local_unnamed_addr { |
| 12 |
%3 = icmp eq i64 %1, 0 |
| 13 |
br i1 %3, label %4, label %6 |
| 14 |
|
| 15 |
; <label>:4: ; preds = %2 |
| 16 |
%5 = load i64, ptr @result, align 8 |
| 17 |
br label %13 |
| 18 |
|
| 19 |
; <label>:6: ; preds = %2 |
| 20 |
%7 = getelementptr inbounds i8, ptr %0, i64 -50000 |
| 21 |
%8 = getelementptr inbounds i8, ptr %0, i64 -61024 |
| 22 |
%9 = getelementptr inbounds i8, ptr %0, i64 -62048 |
| 23 |
%10 = getelementptr inbounds i8, ptr %0, i64 -64096 |
| 24 |
%11 = load i64, ptr @result, align 8 |
| 25 |
br label %15 |
| 26 |
|
| 27 |
; <label>:12: ; preds = %15 |
| 28 |
store i64 %33, ptr @result, align 8 |
| 29 |
br label %13 |
| 30 |
|
| 31 |
; <label>:13: ; preds = %12, %4 |
| 32 |
%14 = phi i64 [ %5, %4 ], [ %33, %12 ] |
| 33 |
ret i64 %14 |
| 34 |
|
| 35 |
; <label>:15: ; preds = %15, %6 |
| 36 |
%16 = phi i64 [ %11, %6 ], [ %33, %15 ] |
| 37 |
%17 = phi i64 [ 0, %6 ], [ %34, %15 ] |
| 38 |
%18 = getelementptr inbounds i8, ptr %7, i64 %17 |
| 39 |
%19 = bitcast ptr %18 to ptr |
| 40 |
%20 = load i64, ptr %19, align 8 |
| 41 |
%21 = getelementptr inbounds i8, ptr %8, i64 %17 |
| 42 |
%22 = bitcast ptr %21 to ptr |
| 43 |
%23 = load i64, ptr %22, align 8 |
| 44 |
%24 = getelementptr inbounds i8, ptr %9, i64 %17 |
| 45 |
%25 = bitcast ptr %24 to ptr |
| 46 |
%26 = load i64, ptr %25, align 8 |
| 47 |
%27 = getelementptr inbounds i8, ptr %10, i64 %17 |
| 48 |
%28 = bitcast ptr %27 to ptr |
| 49 |
%29 = load i64, ptr %28, align 8 |
| 50 |
%30 = mul i64 %23, %20 |
| 51 |
%31 = mul i64 %30, %26 |
| 52 |
%32 = mul i64 %31, %29 |
| 53 |
%33 = mul i64 %32, %16 |
| 54 |
%34 = add nuw i64 %17, 1 |
| 55 |
%35 = icmp eq i64 %34, %1 |
| 56 |
br i1 %35, label %12, label %15 |
| 57 |
} |
| 58 |
|
| 59 |
; CHECK-LABEL: test_preinc_i64_ld |
| 60 |
; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, -11023 |
| 61 |
; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, -12047 |
| 62 |
; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, -14095 |
| 63 |
; CHECK-DAG: ld {{[0-9]+}}, 14096([[REG1:[0-9]+]]) |
| 64 |
; CHECK-DAG: ld {{[0-9]+}}, 3072([[REG1]]) |
| 65 |
; CHECK-DAG: ld {{[0-9]+}}, 2048([[REG1]]) |
| 66 |
; CHECK-DAG: ld {{[0-9]+}}, 0([[REG1]]) |
| 67 |
; CHECK: blr |
| 68 |
|
| 69 |
define i64 @test_preinc_i64_ldst(ptr nocapture, i64, i64) local_unnamed_addr { |
| 70 |
%4 = icmp eq i64 %1, 0 |
| 71 |
br i1 %4, label %5, label %7 |
| 72 |
|
| 73 |
; <label>:5: ; preds = %3 |
| 74 |
%6 = load i64, ptr @result, align 8 |
| 75 |
br label %16 |
| 76 |
|
| 77 |
; <label>:7: ; preds = %3 |
| 78 |
%8 = add i64 %2, 1 |
| 79 |
%9 = getelementptr inbounds i8, ptr %0, i64 -1024 |
| 80 |
%10 = add i64 %2, 2 |
| 81 |
%11 = getelementptr inbounds i8, ptr %0, i64 -2048 |
| 82 |
%12 = getelementptr inbounds i8, ptr %0, i64 -3072 |
| 83 |
%13 = getelementptr inbounds i8, ptr %0, i64 -4096 |
| 84 |
%14 = load i64, ptr @result, align 8 |
| 85 |
br label %18 |
| 86 |
|
| 87 |
; <label>:15: ; preds = %18 |
| 88 |
store i64 %32, ptr @result, align 8 |
| 89 |
br label %16 |
| 90 |
|
| 91 |
; <label>:16: ; preds = %15, %5 |
| 92 |
%17 = phi i64 [ %6, %5 ], [ %32, %15 ] |
| 93 |
ret i64 %17 |
| 94 |
|
| 95 |
; <label>:18: ; preds = %18, %7 |
| 96 |
%19 = phi i64 [ %14, %7 ], [ %32, %18 ] |
| 97 |
%20 = phi i64 [ 0, %7 ], [ %33, %18 ] |
| 98 |
%21 = getelementptr inbounds i8, ptr %9, i64 %20 |
| 99 |
%22 = bitcast ptr %21 to ptr |
| 100 |
store i64 %8, ptr %22, align 8 |
| 101 |
%23 = getelementptr inbounds i8, ptr %11, i64 %20 |
| 102 |
%24 = bitcast ptr %23 to ptr |
| 103 |
store i64 %10, ptr %24, align 8 |
| 104 |
%25 = getelementptr inbounds i8, ptr %12, i64 %20 |
| 105 |
%26 = bitcast ptr %25 to ptr |
| 106 |
%27 = load i64, ptr %26, align 8 |
| 107 |
%28 = getelementptr inbounds i8, ptr %13, i64 %20 |
| 108 |
%29 = bitcast ptr %28 to ptr |
| 109 |
%30 = load i64, ptr %29, align 8 |
| 110 |
%31 = mul i64 %30, %27 |
| 111 |
%32 = mul i64 %31, %19 |
| 112 |
%33 = add nuw i64 %20, 1 |
| 113 |
%34 = icmp eq i64 %33, %1 |
| 114 |
br i1 %34, label %15, label %18 |
| 115 |
} |
| 116 |
|
| 117 |
; CHECK-LABEL: test_preinc_i64_ldst |
| 118 |
; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, -3071 |
| 119 |
; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, -2047 |
| 120 |
; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, -1023 |
| 121 |
; CHECK-DAG: ld {{[0-9]+}}, -1024([[REG2:[0-9]+]]) |
| 122 |
; CHECK-DAG: ld {{[0-9]+}}, -2048([[REG2]]) |
| 123 |
; CHECK-DAG: std {{[0-9]+}}, 1024([[REG2]]) |
| 124 |
; CHECK-DAG: std {{[0-9]+}}, 0([[REG2]]) |