1*207e5cccSFangrui Song // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +fullfp16 \ 2*207e5cccSFangrui Song // RUN: -disable-O0-optnone \ 3*207e5cccSFangrui Song // RUN: -emit-llvm -o - %s | opt -S -passes=mem2reg \ 4*207e5cccSFangrui Song // RUN: | FileCheck --check-prefixes=COMMON,COMMONIR,UNCONSTRAINED %s 5*207e5cccSFangrui Song // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +fullfp16 \ 6*207e5cccSFangrui Song // RUN: -disable-O0-optnone \ 7*207e5cccSFangrui Song // RUN: -ffp-exception-behavior=strict -emit-llvm -o - %s | opt -S -passes=mem2reg \ 8*207e5cccSFangrui Song // RUN: | FileCheck --check-prefixes=COMMON,COMMONIR,CONSTRAINED %s 9*207e5cccSFangrui Song 10*207e5cccSFangrui Song // REQUIRES: aarch64-registered-target 11*207e5cccSFangrui Song 12*207e5cccSFangrui Song #include <arm_fp16.h> 13*207e5cccSFangrui Song 14*207e5cccSFangrui Song // COMMON-LABEL: test_vceqzh_f16 15*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp oeq half %a, 0xH0000 16*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half 0xH0000, metadata !"oeq", metadata !"fpexcept.strict") 17*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 18*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 19*207e5cccSFangrui Song uint16_t test_vceqzh_f16(float16_t a) { 20*207e5cccSFangrui Song return vceqzh_f16(a); 21*207e5cccSFangrui Song } 22*207e5cccSFangrui Song 23*207e5cccSFangrui Song // COMMON-LABEL: test_vcgezh_f16 24*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp oge half %a, 0xH0000 25*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half 0xH0000, metadata !"oge", metadata !"fpexcept.strict") 26*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 27*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 28*207e5cccSFangrui Song uint16_t test_vcgezh_f16(float16_t a) { 29*207e5cccSFangrui Song return vcgezh_f16(a); 30*207e5cccSFangrui Song } 31*207e5cccSFangrui Song 32*207e5cccSFangrui Song // COMMON-LABEL: test_vcgtzh_f16 33*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp ogt half %a, 0xH0000 34*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half 0xH0000, metadata !"ogt", metadata !"fpexcept.strict") 35*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 36*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 37*207e5cccSFangrui Song uint16_t test_vcgtzh_f16(float16_t a) { 38*207e5cccSFangrui Song return vcgtzh_f16(a); 39*207e5cccSFangrui Song } 40*207e5cccSFangrui Song 41*207e5cccSFangrui Song // COMMON-LABEL: test_vclezh_f16 42*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp ole half %a, 0xH0000 43*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half 0xH0000, metadata !"ole", metadata !"fpexcept.strict") 44*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 45*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 46*207e5cccSFangrui Song uint16_t test_vclezh_f16(float16_t a) { 47*207e5cccSFangrui Song return vclezh_f16(a); 48*207e5cccSFangrui Song } 49*207e5cccSFangrui Song 50*207e5cccSFangrui Song // COMMON-LABEL: test_vcltzh_f16 51*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp olt half %a, 0xH0000 52*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half 0xH0000, metadata !"olt", metadata !"fpexcept.strict") 53*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 54*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 55*207e5cccSFangrui Song uint16_t test_vcltzh_f16(float16_t a) { 56*207e5cccSFangrui Song return vcltzh_f16(a); 57*207e5cccSFangrui Song } 58*207e5cccSFangrui Song 59*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_f16_s16 60*207e5cccSFangrui Song // UNCONSTRAINED: [[VCVT:%.*]] = sitofp i16 %a to half 61*207e5cccSFangrui Song // CONSTRAINED: [[VCVT:%.*]] = call half @llvm.experimental.constrained.sitofp.f16.i16(i16 %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 62*207e5cccSFangrui Song // COMMONIR: ret half [[VCVT]] 63*207e5cccSFangrui Song float16_t test_vcvth_f16_s16 (int16_t a) { 64*207e5cccSFangrui Song return vcvth_f16_s16(a); 65*207e5cccSFangrui Song } 66*207e5cccSFangrui Song 67*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_f16_s32 68*207e5cccSFangrui Song // UNCONSTRAINED: [[VCVT:%.*]] = sitofp i32 %a to half 69*207e5cccSFangrui Song // CONSTRAINED: [[VCVT:%.*]] = call half @llvm.experimental.constrained.sitofp.f16.i32(i32 %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 70*207e5cccSFangrui Song // COMMONIR: ret half [[VCVT]] 71*207e5cccSFangrui Song float16_t test_vcvth_f16_s32 (int32_t a) { 72*207e5cccSFangrui Song return vcvth_f16_s32(a); 73*207e5cccSFangrui Song } 74*207e5cccSFangrui Song 75*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_f16_s64 76*207e5cccSFangrui Song // UNCONSTRAINED: [[VCVT:%.*]] = sitofp i64 %a to half 77*207e5cccSFangrui Song // CONSTRAINED: [[VCVT:%.*]] = call half @llvm.experimental.constrained.sitofp.f16.i64(i64 %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 78*207e5cccSFangrui Song // COMMONIR: ret half [[VCVT]] 79*207e5cccSFangrui Song float16_t test_vcvth_f16_s64 (int64_t a) { 80*207e5cccSFangrui Song return vcvth_f16_s64(a); 81*207e5cccSFangrui Song } 82*207e5cccSFangrui Song 83*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_f16_u16 84*207e5cccSFangrui Song // UNCONSTRAINED: [[VCVT:%.*]] = uitofp i16 %a to half 85*207e5cccSFangrui Song // CONSTRAINED: [[VCVT:%.*]] = call half @llvm.experimental.constrained.uitofp.f16.i16(i16 %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 86*207e5cccSFangrui Song // COMMONIR: ret half [[VCVT]] 87*207e5cccSFangrui Song float16_t test_vcvth_f16_u16 (uint16_t a) { 88*207e5cccSFangrui Song return vcvth_f16_u16(a); 89*207e5cccSFangrui Song } 90*207e5cccSFangrui Song 91*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_f16_u32 92*207e5cccSFangrui Song // UNCONSTRAINED: [[VCVT:%.*]] = uitofp i32 %a to half 93*207e5cccSFangrui Song // CONSTRAINED: [[VCVT:%.*]] = call half @llvm.experimental.constrained.uitofp.f16.i32(i32 %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 94*207e5cccSFangrui Song // COMMONIR: ret half [[VCVT]] 95*207e5cccSFangrui Song float16_t test_vcvth_f16_u32 (uint32_t a) { 96*207e5cccSFangrui Song return vcvth_f16_u32(a); 97*207e5cccSFangrui Song } 98*207e5cccSFangrui Song 99*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_f16_u64 100*207e5cccSFangrui Song // UNCONSTRAINED: [[VCVT:%.*]] = uitofp i64 %a to half 101*207e5cccSFangrui Song // CONSTRAINED: [[VCVT:%.*]] = call half @llvm.experimental.constrained.uitofp.f16.i64(i64 %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 102*207e5cccSFangrui Song // COMMONIR: ret half [[VCVT]] 103*207e5cccSFangrui Song float16_t test_vcvth_f16_u64 (uint64_t a) { 104*207e5cccSFangrui Song return vcvth_f16_u64(a); 105*207e5cccSFangrui Song } 106*207e5cccSFangrui Song 107*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_s16_f16 108*207e5cccSFangrui Song // COMMONIR: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtzs.i32.f16(half %a) 109*207e5cccSFangrui Song // COMMONIR: [[TRUNC:%.*]] = trunc i32 [[VCVT]] to i16 110*207e5cccSFangrui Song // COMMONIR: ret i16 [[TRUNC]] 111*207e5cccSFangrui Song int16_t test_vcvth_s16_f16 (float16_t a) { 112*207e5cccSFangrui Song return vcvth_s16_f16(a); 113*207e5cccSFangrui Song } 114*207e5cccSFangrui Song 115*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_s32_f16 116*207e5cccSFangrui Song // COMMONIR: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtzs.i32.f16(half %a) 117*207e5cccSFangrui Song // COMMONIR: ret i32 [[VCVT]] 118*207e5cccSFangrui Song int32_t test_vcvth_s32_f16 (float16_t a) { 119*207e5cccSFangrui Song return vcvth_s32_f16(a); 120*207e5cccSFangrui Song } 121*207e5cccSFangrui Song 122*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_s64_f16 123*207e5cccSFangrui Song // COMMONIR: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtzs.i64.f16(half %a) 124*207e5cccSFangrui Song // COMMONIR: ret i64 [[VCVT]] 125*207e5cccSFangrui Song int64_t test_vcvth_s64_f16 (float16_t a) { 126*207e5cccSFangrui Song return vcvth_s64_f16(a); 127*207e5cccSFangrui Song } 128*207e5cccSFangrui Song 129*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_u16_f16 130*207e5cccSFangrui Song // COMMONIR: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtzu.i32.f16(half %a) 131*207e5cccSFangrui Song // COMMONIR: [[TRUNC:%.*]] = trunc i32 [[VCVT]] to i16 132*207e5cccSFangrui Song // COMMONIR: ret i16 [[TRUNC]] 133*207e5cccSFangrui Song uint16_t test_vcvth_u16_f16 (float16_t a) { 134*207e5cccSFangrui Song return vcvth_u16_f16(a); 135*207e5cccSFangrui Song } 136*207e5cccSFangrui Song 137*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_u32_f16 138*207e5cccSFangrui Song // COMMONIR: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtzu.i32.f16(half %a) 139*207e5cccSFangrui Song // COMMONIR: ret i32 [[VCVT]] 140*207e5cccSFangrui Song uint32_t test_vcvth_u32_f16 (float16_t a) { 141*207e5cccSFangrui Song return vcvth_u32_f16(a); 142*207e5cccSFangrui Song } 143*207e5cccSFangrui Song 144*207e5cccSFangrui Song // COMMON-LABEL: test_vcvth_u64_f16 145*207e5cccSFangrui Song // COMMONIR: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtzu.i64.f16(half %a) 146*207e5cccSFangrui Song // COMMONIR: ret i64 [[VCVT]] 147*207e5cccSFangrui Song uint64_t test_vcvth_u64_f16 (float16_t a) { 148*207e5cccSFangrui Song return vcvth_u64_f16(a); 149*207e5cccSFangrui Song } 150*207e5cccSFangrui Song 151*207e5cccSFangrui Song // COMMON-LABEL: test_vrndh_f16 152*207e5cccSFangrui Song // UNCONSTRAINED: [[RND:%.*]] = call half @llvm.trunc.f16(half %a) 153*207e5cccSFangrui Song // CONSTRAINED: [[RND:%.*]] = call half @llvm.experimental.constrained.trunc.f16(half %a, metadata !"fpexcept.strict") 154*207e5cccSFangrui Song // COMMONIR: ret half [[RND]] 155*207e5cccSFangrui Song float16_t test_vrndh_f16(float16_t a) { 156*207e5cccSFangrui Song return vrndh_f16(a); 157*207e5cccSFangrui Song } 158*207e5cccSFangrui Song 159*207e5cccSFangrui Song // COMMON-LABEL: test_vrndah_f16 160*207e5cccSFangrui Song // UNCONSTRAINED: [[RND:%.*]] = call half @llvm.round.f16(half %a) 161*207e5cccSFangrui Song // CONSTRAINED: [[RND:%.*]] = call half @llvm.experimental.constrained.round.f16(half %a, metadata !"fpexcept.strict") 162*207e5cccSFangrui Song // COMMONIR: ret half [[RND]] 163*207e5cccSFangrui Song float16_t test_vrndah_f16(float16_t a) { 164*207e5cccSFangrui Song return vrndah_f16(a); 165*207e5cccSFangrui Song } 166*207e5cccSFangrui Song 167*207e5cccSFangrui Song // COMMON-LABEL: test_vrndih_f16 168*207e5cccSFangrui Song // UNCONSTRAINED: [[RND:%.*]] = call half @llvm.nearbyint.f16(half %a) 169*207e5cccSFangrui Song // CONSTRAINED: [[RND:%.*]] = call half @llvm.experimental.constrained.nearbyint.f16(half %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 170*207e5cccSFangrui Song // COMMONIR: ret half [[RND]] 171*207e5cccSFangrui Song float16_t test_vrndih_f16(float16_t a) { 172*207e5cccSFangrui Song return vrndih_f16(a); 173*207e5cccSFangrui Song } 174*207e5cccSFangrui Song 175*207e5cccSFangrui Song // COMMON-LABEL: test_vrndmh_f16 176*207e5cccSFangrui Song // UNCONSTRAINED: [[RND:%.*]] = call half @llvm.floor.f16(half %a) 177*207e5cccSFangrui Song // CONSTRAINED: [[RND:%.*]] = call half @llvm.experimental.constrained.floor.f16(half %a, metadata !"fpexcept.strict") 178*207e5cccSFangrui Song // COMMONIR: ret half [[RND]] 179*207e5cccSFangrui Song float16_t test_vrndmh_f16(float16_t a) { 180*207e5cccSFangrui Song return vrndmh_f16(a); 181*207e5cccSFangrui Song } 182*207e5cccSFangrui Song 183*207e5cccSFangrui Song // COMMON-LABEL: test_vrndph_f16 184*207e5cccSFangrui Song // UNCONSTRAINED: [[RND:%.*]] = call half @llvm.ceil.f16(half %a) 185*207e5cccSFangrui Song // CONSTRAINED: [[RND:%.*]] = call half @llvm.experimental.constrained.ceil.f16(half %a, metadata !"fpexcept.strict") 186*207e5cccSFangrui Song // COMMONIR: ret half [[RND]] 187*207e5cccSFangrui Song float16_t test_vrndph_f16(float16_t a) { 188*207e5cccSFangrui Song return vrndph_f16(a); 189*207e5cccSFangrui Song } 190*207e5cccSFangrui Song 191*207e5cccSFangrui Song // COMMON-LABEL: test_vrndxh_f16 192*207e5cccSFangrui Song // UNCONSTRAINED: [[RND:%.*]] = call half @llvm.rint.f16(half %a) 193*207e5cccSFangrui Song // CONSTRAINED: [[RND:%.*]] = call half @llvm.experimental.constrained.rint.f16(half %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 194*207e5cccSFangrui Song // COMMONIR: ret half [[RND]] 195*207e5cccSFangrui Song float16_t test_vrndxh_f16(float16_t a) { 196*207e5cccSFangrui Song return vrndxh_f16(a); 197*207e5cccSFangrui Song } 198*207e5cccSFangrui Song 199*207e5cccSFangrui Song // COMMON-LABEL: test_vsqrth_f16 200*207e5cccSFangrui Song // UNCONSTRAINED: [[SQR:%.*]] = call half @llvm.sqrt.f16(half %a) 201*207e5cccSFangrui Song // CONSTRAINED: [[SQR:%.*]] = call half @llvm.experimental.constrained.sqrt.f16(half %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 202*207e5cccSFangrui Song // COMMONIR: ret half [[SQR]] 203*207e5cccSFangrui Song float16_t test_vsqrth_f16(float16_t a) { 204*207e5cccSFangrui Song return vsqrth_f16(a); 205*207e5cccSFangrui Song } 206*207e5cccSFangrui Song 207*207e5cccSFangrui Song // COMMON-LABEL: test_vaddh_f16 208*207e5cccSFangrui Song // UNCONSTRAINED: [[ADD:%.*]] = fadd half %a, %b 209*207e5cccSFangrui Song // CONSTRAINED: [[ADD:%.*]] = call half @llvm.experimental.constrained.fadd.f16(half %a, half %b, metadata !"round.tonearest", metadata !"fpexcept.strict") 210*207e5cccSFangrui Song // COMMONIR: ret half [[ADD]] 211*207e5cccSFangrui Song float16_t test_vaddh_f16(float16_t a, float16_t b) { 212*207e5cccSFangrui Song return vaddh_f16(a, b); 213*207e5cccSFangrui Song } 214*207e5cccSFangrui Song 215*207e5cccSFangrui Song // COMMON-LABEL: test_vceqh_f16 216*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp oeq half %a, %b 217*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"oeq", metadata !"fpexcept.strict") 218*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 219*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 220*207e5cccSFangrui Song uint16_t test_vceqh_f16(float16_t a, float16_t b) { 221*207e5cccSFangrui Song return vceqh_f16(a, b); 222*207e5cccSFangrui Song } 223*207e5cccSFangrui Song 224*207e5cccSFangrui Song // COMMON-LABEL: test_vcgeh_f16 225*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp oge half %a, %b 226*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"oge", metadata !"fpexcept.strict") 227*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 228*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 229*207e5cccSFangrui Song uint16_t test_vcgeh_f16(float16_t a, float16_t b) { 230*207e5cccSFangrui Song return vcgeh_f16(a, b); 231*207e5cccSFangrui Song } 232*207e5cccSFangrui Song 233*207e5cccSFangrui Song // COMMON-LABEL: test_vcgth_f16 234*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp ogt half %a, %b 235*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ogt", metadata !"fpexcept.strict") 236*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 237*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 238*207e5cccSFangrui Song uint16_t test_vcgth_f16(float16_t a, float16_t b) { 239*207e5cccSFangrui Song return vcgth_f16(a, b); 240*207e5cccSFangrui Song } 241*207e5cccSFangrui Song 242*207e5cccSFangrui Song // COMMON-LABEL: test_vcleh_f16 243*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp ole half %a, %b 244*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ole", metadata !"fpexcept.strict") 245*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 246*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 247*207e5cccSFangrui Song uint16_t test_vcleh_f16(float16_t a, float16_t b) { 248*207e5cccSFangrui Song return vcleh_f16(a, b); 249*207e5cccSFangrui Song } 250*207e5cccSFangrui Song 251*207e5cccSFangrui Song // COMMON-LABEL: test_vclth_f16 252*207e5cccSFangrui Song // UNCONSTRAINED: [[TMP1:%.*]] = fcmp olt half %a, %b 253*207e5cccSFangrui Song // CONSTRAINED: [[TMP1:%.*]] = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"olt", metadata !"fpexcept.strict") 254*207e5cccSFangrui Song // COMMONIR: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 255*207e5cccSFangrui Song // COMMONIR: ret i16 [[TMP2]] 256*207e5cccSFangrui Song uint16_t test_vclth_f16(float16_t a, float16_t b) { 257*207e5cccSFangrui Song return vclth_f16(a, b); 258*207e5cccSFangrui Song } 259*207e5cccSFangrui Song 260*207e5cccSFangrui Song // COMMON-LABEL: test_vdivh_f16 261*207e5cccSFangrui Song // UNCONSTRAINED: [[DIV:%.*]] = fdiv half %a, %b 262*207e5cccSFangrui Song // CONSTRAINED: [[DIV:%.*]] = call half @llvm.experimental.constrained.fdiv.f16(half %a, half %b, metadata !"round.tonearest", metadata !"fpexcept.strict") 263*207e5cccSFangrui Song // COMMONIR: ret half [[DIV]] 264*207e5cccSFangrui Song float16_t test_vdivh_f16(float16_t a, float16_t b) { 265*207e5cccSFangrui Song return vdivh_f16(a, b); 266*207e5cccSFangrui Song } 267*207e5cccSFangrui Song 268*207e5cccSFangrui Song // COMMON-LABEL: test_vmulh_f16 269*207e5cccSFangrui Song // UNCONSTRAINED: [[MUL:%.*]] = fmul half %a, %b 270*207e5cccSFangrui Song // CONSTRAINED: [[MUL:%.*]] = call half @llvm.experimental.constrained.fmul.f16(half %a, half %b, metadata !"round.tonearest", metadata !"fpexcept.strict") 271*207e5cccSFangrui Song // COMMONIR: ret half [[MUL]] 272*207e5cccSFangrui Song float16_t test_vmulh_f16(float16_t a, float16_t b) { 273*207e5cccSFangrui Song return vmulh_f16(a, b); 274*207e5cccSFangrui Song } 275*207e5cccSFangrui Song 276*207e5cccSFangrui Song // COMMON-LABEL: test_vsubh_f16 277*207e5cccSFangrui Song // UNCONSTRAINED: [[SUB:%.*]] = fsub half %a, %b 278*207e5cccSFangrui Song // CONSTRAINED: [[SUB:%.*]] = call half @llvm.experimental.constrained.fsub.f16(half %a, half %b, metadata !"round.tonearest", metadata !"fpexcept.strict") 279*207e5cccSFangrui Song // COMMONIR: ret half [[SUB]] 280*207e5cccSFangrui Song float16_t test_vsubh_f16(float16_t a, float16_t b) { 281*207e5cccSFangrui Song return vsubh_f16(a, b); 282*207e5cccSFangrui Song } 283*207e5cccSFangrui Song 284*207e5cccSFangrui Song // COMMON-LABEL: test_vfmah_f16 285*207e5cccSFangrui Song // UNCONSTRAINED: [[FMA:%.*]] = call half @llvm.fma.f16(half %b, half %c, half %a) 286*207e5cccSFangrui Song // CONSTRAINED: [[FMA:%.*]] = call half @llvm.experimental.constrained.fma.f16(half %b, half %c, half %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 287*207e5cccSFangrui Song // COMMONIR: ret half [[FMA]] 288*207e5cccSFangrui Song float16_t test_vfmah_f16(float16_t a, float16_t b, float16_t c) { 289*207e5cccSFangrui Song return vfmah_f16(a, b, c); 290*207e5cccSFangrui Song } 291*207e5cccSFangrui Song 292*207e5cccSFangrui Song // COMMON-LABEL: test_vfmsh_f16 293*207e5cccSFangrui Song // COMMONIR: [[SUB:%.*]] = fneg half %b 294*207e5cccSFangrui Song // UNCONSTRAINED: [[ADD:%.*]] = call half @llvm.fma.f16(half [[SUB]], half %c, half %a) 295*207e5cccSFangrui Song // CONSTRAINED: [[ADD:%.*]] = call half @llvm.experimental.constrained.fma.f16(half [[SUB]], half %c, half %a, metadata !"round.tonearest", metadata !"fpexcept.strict") 296*207e5cccSFangrui Song // COMMONIR: ret half [[ADD]] 297*207e5cccSFangrui Song float16_t test_vfmsh_f16(float16_t a, float16_t b, float16_t c) { 298*207e5cccSFangrui Song return vfmsh_f16(a, b, c); 299*207e5cccSFangrui Song } 300*207e5cccSFangrui Song 301