1; Test if we can read load instructions. 2 3; RUN: %p2i --no-local-syms -i %s --insts | FileCheck %s 4; RUN: %p2i -i %s --args -notranslate -timing | \ 5; RUN: FileCheck --check-prefix=NOIR %s 6 7define internal i32 @load_i8(i32 %addr) { 8entry: 9 %addr_i8 = inttoptr i32 %addr to i8* 10 %v = load i8, i8* %addr_i8, align 1 11 %r = sext i8 %v to i32 12 ret i32 %r 13 14; CHECK: __0: 15; CHECK-NEXT: %__1 = load i8, i8* %__0, align 1 16; CHECK-NEXT: %__2 = sext i8 %__1 to i32 17; CHECK-NEXT: ret i32 %__2 18} 19 20define internal i32 @load_i16(i32 %addr) { 21entry: 22 %addr_i16 = inttoptr i32 %addr to i16* 23 %v = load i16, i16* %addr_i16, align 1 24 %r = sext i16 %v to i32 25 ret i32 %r 26 27; CHECK: __0: 28; CHECK-NEXT: %__1 = load i16, i16* %__0, align 1 29; CHECK-NEXT: %__2 = sext i16 %__1 to i32 30; CHECK-NEXT: ret i32 %__2 31} 32 33define internal i32 @load_i32(i32 %addr) { 34entry: 35 %addr_i32 = inttoptr i32 %addr to i32* 36 %v = load i32, i32* %addr_i32, align 1 37 ret i32 %v 38 39; CHECK: __0: 40; CHECK-NEXT: %__1 = load i32, i32* %__0, align 1 41; CHECK-NEXT: ret i32 %__1 42} 43 44define internal i64 @load_i64(i32 %addr) { 45entry: 46 %addr_i64 = inttoptr i32 %addr to i64* 47 %v = load i64, i64* %addr_i64, align 1 48 ret i64 %v 49 50; CHECK: __0: 51; CHECK-NEXT: %__1 = load i64, i64* %__0, align 1 52; CHECK-NEXT: ret i64 %__1 53} 54 55define internal float @load_float_a1(i32 %addr) { 56entry: 57 %addr_float = inttoptr i32 %addr to float* 58 %v = load float, float* %addr_float, align 1 59 ret float %v 60 61; TODO(kschimpf) Fix load alignment in ICE to allow non-default. 62 63; CHECK: __0: 64; CHECK-NEXT: %__1 = load float, float* %__0, align 4 65; CHECK-NEXT: ret float %__1 66} 67 68 69define internal float @load_float_a4(i32 %addr) { 70entry: 71 %addr_float = inttoptr i32 %addr to float* 72 %v = load float, float* %addr_float, align 4 73 ret float %v 74 75; CHECK: __0: 76; CHECK-NEXT: %__1 = load float, float* %__0, align 4 77; CHECK-NEXT: ret float %__1 78} 79 80define internal double @load_double_a1(i32 %addr) { 81entry: 82 %addr_double = inttoptr i32 %addr to double* 83 %v = load double, double* %addr_double, align 1 84 ret double %v 85 86; TODO(kschimpf) Fix load alignment in ICE to allow non-default. 87 88; CHECK: __0: 89; CHECK-NEXT: %__1 = load double, double* %__0, align 8 90; CHECK-NEXT: ret double %__1 91} 92 93 94define internal double @load_double_a8(i32 %addr) { 95entry: 96 %addr_double = inttoptr i32 %addr to double* 97 %v = load double, double* %addr_double, align 8 98 ret double %v 99 100; CHECK: __0: 101; CHECK-NEXT: %__1 = load double, double* %__0, align 8 102; CHECK-NEXT: ret double %__1 103} 104 105define internal <16 x i8> @load_v16xI8(i32 %addr) { 106entry: 107 %addr_v16xI8 = inttoptr i32 %addr to <16 x i8>* 108 %v = load <16 x i8>, <16 x i8>* %addr_v16xI8, align 1 109 ret <16 x i8> %v 110 111; CHECK: __0: 112; CHECK-NEXT: %__1 = load <16 x i8>, <16 x i8>* %__0, align 1 113; CHECK-NEXT: ret <16 x i8> %__1 114} 115 116define internal <8 x i16> @load_v8xI16(i32 %addr) { 117entry: 118 %addr_v8xI16 = inttoptr i32 %addr to <8 x i16>* 119 %v = load <8 x i16>, <8 x i16>* %addr_v8xI16, align 2 120 ret <8 x i16> %v 121 122; CHECK: __0: 123; CHECK-NEXT: %__1 = load <8 x i16>, <8 x i16>* %__0, align 2 124; CHECK-NEXT: ret <8 x i16> %__1 125} 126 127define internal <4 x i32> @load_v4xI32(i32 %addr) { 128entry: 129 %addr_v4xI32 = inttoptr i32 %addr to <4 x i32>* 130 %v = load <4 x i32>, <4 x i32>* %addr_v4xI32, align 4 131 ret <4 x i32> %v 132 133; CHECK: __0: 134; CHECK-NEXT: %__1 = load <4 x i32>, <4 x i32>* %__0, align 4 135; CHECK-NEXT: ret <4 x i32> %__1 136} 137 138define internal <4 x float> @load_v4xFloat(i32 %addr) { 139entry: 140 %addr_v4xFloat = inttoptr i32 %addr to <4 x float>* 141 %v = load <4 x float>, <4 x float>* %addr_v4xFloat, align 4 142 ret <4 x float> %v 143 144; CHECK: __0: 145; CHECK-NEXT: %__1 = load <4 x float>, <4 x float>* %__0, align 4 146; CHECK-NEXT: ret <4 x float> %__1 147} 148 149; NOIR: Total across all functions 150