|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 |
| 2 | +; RUN: opt -S -passes=instcombine %s | FileCheck -check-prefixes=CHECK,LDEXP %s |
| 3 | +; RUN: opt -S -passes=instcombine -disable-builtin=ldexpf -disable-builtin=ldexp -disable-builtin=ldexpl %s | FileCheck -check-prefixes=CHECK,NOLDEXP %s |
| 4 | + |
| 5 | +define float @exp2_f32_sitofp_i8(i8 %x) { |
| 6 | +; LDEXP-LABEL: define float @exp2_f32_sitofp_i8( |
| 7 | +; LDEXP-SAME: i8 [[X:%.*]]) { |
| 8 | +; LDEXP-NEXT: [[TMP1:%.*]] = sext i8 [[X]] to i32 |
| 9 | +; LDEXP-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[TMP1]]) |
| 10 | +; LDEXP-NEXT: ret float [[LDEXPF]] |
| 11 | +; |
| 12 | +; NOLDEXP-LABEL: define float @exp2_f32_sitofp_i8( |
| 13 | +; NOLDEXP-SAME: i8 [[X:%.*]]) { |
| 14 | +; NOLDEXP-NEXT: [[ITOFP:%.*]] = sitofp i8 [[X]] to float |
| 15 | +; NOLDEXP-NEXT: [[EXP2:%.*]] = call float @llvm.exp2.f32(float [[ITOFP]]) |
| 16 | +; NOLDEXP-NEXT: ret float [[EXP2]] |
| 17 | +; |
| 18 | + %itofp = sitofp i8 %x to float |
| 19 | + %exp2 = call float @llvm.exp2.f32(float %itofp) |
| 20 | + ret float %exp2 |
| 21 | +} |
| 22 | + |
| 23 | +define float @exp2_f32_sitofp_i8_flags(i8 %x) { |
| 24 | +; LDEXP-LABEL: define float @exp2_f32_sitofp_i8_flags( |
| 25 | +; LDEXP-SAME: i8 [[X:%.*]]) { |
| 26 | +; LDEXP-NEXT: [[TMP1:%.*]] = sext i8 [[X]] to i32 |
| 27 | +; LDEXP-NEXT: [[LDEXPF:%.*]] = call nnan ninf float @ldexpf(float 1.000000e+00, i32 [[TMP1]]) |
| 28 | +; LDEXP-NEXT: ret float [[LDEXPF]] |
| 29 | +; |
| 30 | +; NOLDEXP-LABEL: define float @exp2_f32_sitofp_i8_flags( |
| 31 | +; NOLDEXP-SAME: i8 [[X:%.*]]) { |
| 32 | +; NOLDEXP-NEXT: [[ITOFP:%.*]] = sitofp i8 [[X]] to float |
| 33 | +; NOLDEXP-NEXT: [[EXP2:%.*]] = call nnan ninf float @llvm.exp2.f32(float [[ITOFP]]) |
| 34 | +; NOLDEXP-NEXT: ret float [[EXP2]] |
| 35 | +; |
| 36 | + %itofp = sitofp i8 %x to float |
| 37 | + %exp2 = call nnan ninf float @llvm.exp2.f32(float %itofp) |
| 38 | + ret float %exp2 |
| 39 | +} |
| 40 | + |
| 41 | +define <2 x float> @exp2_v2f32_sitofp_v2i8(<2 x i8> %x) { |
| 42 | +; CHECK-LABEL: define <2 x float> @exp2_v2f32_sitofp_v2i8( |
| 43 | +; CHECK-SAME: <2 x i8> [[X:%.*]]) { |
| 44 | +; CHECK-NEXT: [[ITOFP:%.*]] = sitofp <2 x i8> [[X]] to <2 x float> |
| 45 | +; CHECK-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[ITOFP]]) |
| 46 | +; CHECK-NEXT: ret <2 x float> [[EXP2]] |
| 47 | +; |
| 48 | + %itofp = sitofp <2 x i8> %x to <2 x float> |
| 49 | + %exp2 = call <2 x float> @llvm.exp2.v2f32(<2 x float> %itofp) |
| 50 | + ret <2 x float> %exp2 |
| 51 | +} |
| 52 | + |
| 53 | +define float @exp2_f32_uitofp_i8(i8 %x) { |
| 54 | +; LDEXP-LABEL: define float @exp2_f32_uitofp_i8( |
| 55 | +; LDEXP-SAME: i8 [[X:%.*]]) { |
| 56 | +; LDEXP-NEXT: [[TMP1:%.*]] = zext i8 [[X]] to i32 |
| 57 | +; LDEXP-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[TMP1]]) |
| 58 | +; LDEXP-NEXT: ret float [[LDEXPF]] |
| 59 | +; |
| 60 | +; NOLDEXP-LABEL: define float @exp2_f32_uitofp_i8( |
| 61 | +; NOLDEXP-SAME: i8 [[X:%.*]]) { |
| 62 | +; NOLDEXP-NEXT: [[ITOFP:%.*]] = uitofp i8 [[X]] to float |
| 63 | +; NOLDEXP-NEXT: [[EXP2:%.*]] = call float @llvm.exp2.f32(float [[ITOFP]]) |
| 64 | +; NOLDEXP-NEXT: ret float [[EXP2]] |
| 65 | +; |
| 66 | + %itofp = uitofp i8 %x to float |
| 67 | + %exp2 = call float @llvm.exp2.f32(float %itofp) |
| 68 | + ret float %exp2 |
| 69 | +} |
| 70 | + |
| 71 | +define half @exp2_f16_sitofp_i8(i8 %x) { |
| 72 | +; CHECK-LABEL: define half @exp2_f16_sitofp_i8( |
| 73 | +; CHECK-SAME: i8 [[X:%.*]]) { |
| 74 | +; CHECK-NEXT: [[ITOFP:%.*]] = sitofp i8 [[X]] to half |
| 75 | +; CHECK-NEXT: [[EXP2:%.*]] = call half @llvm.exp2.f16(half [[ITOFP]]) |
| 76 | +; CHECK-NEXT: ret half [[EXP2]] |
| 77 | +; |
| 78 | + %itofp = sitofp i8 %x to half |
| 79 | + %exp2 = call half @llvm.exp2.f16(half %itofp) |
| 80 | + ret half %exp2 |
| 81 | +} |
| 82 | + |
| 83 | +define double @exp2_f64_sitofp_i8(i8 %x) { |
| 84 | +; LDEXP-LABEL: define double @exp2_f64_sitofp_i8( |
| 85 | +; LDEXP-SAME: i8 [[X:%.*]]) { |
| 86 | +; LDEXP-NEXT: [[TMP1:%.*]] = sext i8 [[X]] to i32 |
| 87 | +; LDEXP-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]]) |
| 88 | +; LDEXP-NEXT: ret double [[LDEXP]] |
| 89 | +; |
| 90 | +; NOLDEXP-LABEL: define double @exp2_f64_sitofp_i8( |
| 91 | +; NOLDEXP-SAME: i8 [[X:%.*]]) { |
| 92 | +; NOLDEXP-NEXT: [[ITOFP:%.*]] = sitofp i8 [[X]] to double |
| 93 | +; NOLDEXP-NEXT: [[EXP2:%.*]] = call double @llvm.exp2.f64(double [[ITOFP]]) |
| 94 | +; NOLDEXP-NEXT: ret double [[EXP2]] |
| 95 | +; |
| 96 | + %itofp = sitofp i8 %x to double |
| 97 | + %exp2 = call double @llvm.exp2.f64(double %itofp) |
| 98 | + ret double %exp2 |
| 99 | +} |
| 100 | + |
| 101 | +define fp128 @exp2_fp128_sitofp_i8(i8 %x) { |
| 102 | +; LDEXP-LABEL: define fp128 @exp2_fp128_sitofp_i8( |
| 103 | +; LDEXP-SAME: i8 [[X:%.*]]) { |
| 104 | +; LDEXP-NEXT: [[TMP1:%.*]] = sext i8 [[X]] to i32 |
| 105 | +; LDEXP-NEXT: [[LDEXPL:%.*]] = call fp128 @ldexpl(fp128 0xL00000000000000003FFF000000000000, i32 [[TMP1]]) |
| 106 | +; LDEXP-NEXT: ret fp128 [[LDEXPL]] |
| 107 | +; |
| 108 | +; NOLDEXP-LABEL: define fp128 @exp2_fp128_sitofp_i8( |
| 109 | +; NOLDEXP-SAME: i8 [[X:%.*]]) { |
| 110 | +; NOLDEXP-NEXT: [[ITOFP:%.*]] = sitofp i8 [[X]] to fp128 |
| 111 | +; NOLDEXP-NEXT: [[EXP2:%.*]] = call fp128 @llvm.exp2.f128(fp128 [[ITOFP]]) |
| 112 | +; NOLDEXP-NEXT: ret fp128 [[EXP2]] |
| 113 | +; |
| 114 | + %itofp = sitofp i8 %x to fp128 |
| 115 | + %exp2 = call fp128 @llvm.exp2.fp128(fp128 %itofp) |
| 116 | + ret fp128 %exp2 |
| 117 | +} |
| 118 | + |
| 119 | +define <vscale x 4 x float> @exp2_nxv4f32_sitofp_i8(<vscale x 4 x i8> %x) { |
| 120 | +; CHECK-LABEL: define <vscale x 4 x float> @exp2_nxv4f32_sitofp_i8( |
| 121 | +; CHECK-SAME: <vscale x 4 x i8> [[X:%.*]]) { |
| 122 | +; CHECK-NEXT: [[ITOFP:%.*]] = sitofp <vscale x 4 x i8> [[X]] to <vscale x 4 x float> |
| 123 | +; CHECK-NEXT: [[EXP2:%.*]] = call <vscale x 4 x float> @llvm.exp2.nxv4f32(<vscale x 4 x float> [[ITOFP]]) |
| 124 | +; CHECK-NEXT: ret <vscale x 4 x float> [[EXP2]] |
| 125 | +; |
| 126 | + %itofp = sitofp <vscale x 4 x i8> %x to <vscale x 4 x float> |
| 127 | + %exp2 = call <vscale x 4 x float> @llvm.exp2.nxv4f32(<vscale x 4 x float> %itofp) |
| 128 | + ret <vscale x 4 x float> %exp2 |
| 129 | +} |
| 130 | + |
| 131 | +; FIXME: This asserts |
| 132 | +; define bfloat @exp2_bf16_sitofp_i8(i8 %x) { |
| 133 | +; %itofp = sitofp i8 %x to bfloat |
| 134 | +; %exp2 = call bfloat @llvm.exp2.bf16(bfloat %itofp) |
| 135 | +; ret bfloat %exp2 |
| 136 | +; } |
| 137 | + |
| 138 | +; FIXME: This asserts |
| 139 | +; define ppc_fp128 @exp2_ppc_fp128_sitofp_i8(i8 %x) { |
| 140 | +; %itofp = sitofp i8 %x to ppc_fp128 |
| 141 | +; %exp2 = call ppc_fp128 @llvm.exp2.ppcf128(ppc_fp128 %itofp) |
| 142 | +; ret ppc_fp128 %exp2 |
| 143 | +; } |
| 144 | + |
| 145 | +; FIXME: This asserts |
| 146 | +; define x86_fp80 @exp2_x86_fp80_sitofp_i8(i8 %x) { |
| 147 | +; %itofp = sitofp i8 %x to x86_fp80 |
| 148 | +; %exp2 = call x86_fp80 @llvm.exp2.f80(x86_fp80 %itofp) |
| 149 | +; ret x86_fp80 %exp2 |
| 150 | +; } |
0 commit comments