1*207e5cccSFangrui Song // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +fullfp16\ 2*207e5cccSFangrui Song // RUN: -disable-O0-optnone -emit-llvm -o - %s \ 3*207e5cccSFangrui Song // RUN: | opt -S -passes=mem2reg \ 4*207e5cccSFangrui Song // RUN: | FileCheck %s 5*207e5cccSFangrui Song 6*207e5cccSFangrui Song // REQUIRES: aarch64-registered-target 7*207e5cccSFangrui Song 8*207e5cccSFangrui Song #include <arm_fp16.h> 9*207e5cccSFangrui Song 10*207e5cccSFangrui Song // CHECK-LABEL: test_vabsh_f16 11*207e5cccSFangrui Song // CHECK: [[ABS:%.*]] = call half @llvm.fabs.f16(half %a) 12*207e5cccSFangrui Song // CHECK: ret half [[ABS]] 13*207e5cccSFangrui Song float16_t test_vabsh_f16(float16_t a) { 14*207e5cccSFangrui Song return vabsh_f16(a); 15*207e5cccSFangrui Song } 16*207e5cccSFangrui Song 17*207e5cccSFangrui Song // CHECK-LABEL: test_vceqzh_f16 18*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp oeq half %a, 0xH0000 19*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 20*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 21*207e5cccSFangrui Song uint16_t test_vceqzh_f16(float16_t a) { 22*207e5cccSFangrui Song return vceqzh_f16(a); 23*207e5cccSFangrui Song } 24*207e5cccSFangrui Song 25*207e5cccSFangrui Song // CHECK-LABEL: test_vcgezh_f16 26*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp oge half %a, 0xH0000 27*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 28*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 29*207e5cccSFangrui Song uint16_t test_vcgezh_f16(float16_t a) { 30*207e5cccSFangrui Song return vcgezh_f16(a); 31*207e5cccSFangrui Song } 32*207e5cccSFangrui Song 33*207e5cccSFangrui Song // CHECK-LABEL: test_vcgtzh_f16 34*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp ogt half %a, 0xH0000 35*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 36*207e5cccSFangrui Song // CHECK: 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 // CHECK-LABEL: test_vclezh_f16 42*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp ole half %a, 0xH0000 43*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 44*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 45*207e5cccSFangrui Song uint16_t test_vclezh_f16(float16_t a) { 46*207e5cccSFangrui Song return vclezh_f16(a); 47*207e5cccSFangrui Song } 48*207e5cccSFangrui Song 49*207e5cccSFangrui Song // CHECK-LABEL: test_vcltzh_f16 50*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp olt half %a, 0xH0000 51*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 52*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 53*207e5cccSFangrui Song uint16_t test_vcltzh_f16(float16_t a) { 54*207e5cccSFangrui Song return vcltzh_f16(a); 55*207e5cccSFangrui Song } 56*207e5cccSFangrui Song 57*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_f16_s16 58*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = sitofp i16 %a to half 59*207e5cccSFangrui Song // CHECK: ret half [[VCVT]] 60*207e5cccSFangrui Song float16_t test_vcvth_f16_s16 (int16_t a) { 61*207e5cccSFangrui Song return vcvth_f16_s16(a); 62*207e5cccSFangrui Song } 63*207e5cccSFangrui Song 64*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_f16_s32 65*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = sitofp i32 %a to half 66*207e5cccSFangrui Song // CHECK: ret half [[VCVT]] 67*207e5cccSFangrui Song float16_t test_vcvth_f16_s32 (int32_t a) { 68*207e5cccSFangrui Song return vcvth_f16_s32(a); 69*207e5cccSFangrui Song } 70*207e5cccSFangrui Song 71*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_f16_s64 72*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = sitofp i64 %a to half 73*207e5cccSFangrui Song // CHECK: ret half [[VCVT]] 74*207e5cccSFangrui Song float16_t test_vcvth_f16_s64 (int64_t a) { 75*207e5cccSFangrui Song return vcvth_f16_s64(a); 76*207e5cccSFangrui Song } 77*207e5cccSFangrui Song 78*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_f16_u16 79*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = uitofp i16 %a to half 80*207e5cccSFangrui Song // CHECK: ret half [[VCVT]] 81*207e5cccSFangrui Song float16_t test_vcvth_f16_u16 (uint16_t a) { 82*207e5cccSFangrui Song return vcvth_f16_u16(a); 83*207e5cccSFangrui Song } 84*207e5cccSFangrui Song 85*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_f16_u32 86*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = uitofp i32 %a to half 87*207e5cccSFangrui Song // CHECK: ret half [[VCVT]] 88*207e5cccSFangrui Song float16_t test_vcvth_f16_u32 (uint32_t a) { 89*207e5cccSFangrui Song return vcvth_f16_u32(a); 90*207e5cccSFangrui Song } 91*207e5cccSFangrui Song 92*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_f16_u64 93*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = uitofp i64 %a to half 94*207e5cccSFangrui Song // CHECK: ret half [[VCVT]] 95*207e5cccSFangrui Song float16_t test_vcvth_f16_u64 (uint64_t a) { 96*207e5cccSFangrui Song return vcvth_f16_u64(a); 97*207e5cccSFangrui Song } 98*207e5cccSFangrui Song 99*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_s16_f16 100*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtzs.i32.f16(half %a) 101*207e5cccSFangrui Song // CHECK: [[TRUNC:%.*]] = trunc i32 [[VCVT]] to i16 102*207e5cccSFangrui Song // CHECK: ret i16 [[TRUNC]] 103*207e5cccSFangrui Song int16_t test_vcvth_s16_f16 (float16_t a) { 104*207e5cccSFangrui Song return vcvth_s16_f16(a); 105*207e5cccSFangrui Song } 106*207e5cccSFangrui Song 107*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_s32_f16 108*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtzs.i32.f16(half %a) 109*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 110*207e5cccSFangrui Song int32_t test_vcvth_s32_f16 (float16_t a) { 111*207e5cccSFangrui Song return vcvth_s32_f16(a); 112*207e5cccSFangrui Song } 113*207e5cccSFangrui Song 114*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_s64_f16 115*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtzs.i64.f16(half %a) 116*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 117*207e5cccSFangrui Song int64_t test_vcvth_s64_f16 (float16_t a) { 118*207e5cccSFangrui Song return vcvth_s64_f16(a); 119*207e5cccSFangrui Song } 120*207e5cccSFangrui Song 121*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_u16_f16 122*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtzu.i32.f16(half %a) 123*207e5cccSFangrui Song // CHECK: [[TRUNC:%.*]] = trunc i32 [[VCVT]] to i16 124*207e5cccSFangrui Song // CHECK: ret i16 [[TRUNC]] 125*207e5cccSFangrui Song uint16_t test_vcvth_u16_f16 (float16_t a) { 126*207e5cccSFangrui Song return vcvth_u16_f16(a); 127*207e5cccSFangrui Song } 128*207e5cccSFangrui Song 129*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_u32_f16 130*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtzu.i32.f16(half %a) 131*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 132*207e5cccSFangrui Song uint32_t test_vcvth_u32_f16 (float16_t a) { 133*207e5cccSFangrui Song return vcvth_u32_f16(a); 134*207e5cccSFangrui Song } 135*207e5cccSFangrui Song 136*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_u64_f16 137*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtzu.i64.f16(half %a) 138*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 139*207e5cccSFangrui Song uint64_t test_vcvth_u64_f16 (float16_t a) { 140*207e5cccSFangrui Song return vcvth_u64_f16(a); 141*207e5cccSFangrui Song } 142*207e5cccSFangrui Song 143*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtah_s16_f16 144*207e5cccSFangrui Song // CHECK: [[FCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtas.i32.f16(half %a) 145*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FCVT]] to i16 146*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 147*207e5cccSFangrui Song int16_t test_vcvtah_s16_f16 (float16_t a) { 148*207e5cccSFangrui Song return vcvtah_s16_f16(a); 149*207e5cccSFangrui Song } 150*207e5cccSFangrui Song 151*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtah_s32_f16 152*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtas.i32.f16(half %a) 153*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 154*207e5cccSFangrui Song int32_t test_vcvtah_s32_f16 (float16_t a) { 155*207e5cccSFangrui Song return vcvtah_s32_f16(a); 156*207e5cccSFangrui Song } 157*207e5cccSFangrui Song 158*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtah_s64_f16 159*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtas.i64.f16(half %a) 160*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 161*207e5cccSFangrui Song int64_t test_vcvtah_s64_f16 (float16_t a) { 162*207e5cccSFangrui Song return vcvtah_s64_f16(a); 163*207e5cccSFangrui Song } 164*207e5cccSFangrui Song 165*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtah_u16_f16 166*207e5cccSFangrui Song // CHECK: [[FCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtau.i32.f16(half %a) 167*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FCVT]] to i16 168*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 169*207e5cccSFangrui Song uint16_t test_vcvtah_u16_f16 (float16_t a) { 170*207e5cccSFangrui Song return vcvtah_u16_f16(a); 171*207e5cccSFangrui Song } 172*207e5cccSFangrui Song 173*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtah_u32_f16 174*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtau.i32.f16(half %a) 175*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 176*207e5cccSFangrui Song uint32_t test_vcvtah_u32_f16 (float16_t a) { 177*207e5cccSFangrui Song return vcvtah_u32_f16(a); 178*207e5cccSFangrui Song } 179*207e5cccSFangrui Song 180*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtah_u64_f16 181*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtau.i64.f16(half %a) 182*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 183*207e5cccSFangrui Song uint64_t test_vcvtah_u64_f16 (float16_t a) { 184*207e5cccSFangrui Song return vcvtah_u64_f16(a); 185*207e5cccSFangrui Song } 186*207e5cccSFangrui Song 187*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtmh_s16_f16 188*207e5cccSFangrui Song // CHECK: [[FCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtms.i32.f16(half %a) 189*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FCVT]] to i16 190*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 191*207e5cccSFangrui Song int16_t test_vcvtmh_s16_f16 (float16_t a) { 192*207e5cccSFangrui Song return vcvtmh_s16_f16(a); 193*207e5cccSFangrui Song } 194*207e5cccSFangrui Song 195*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtmh_s32_f16 196*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtms.i32.f16(half %a) 197*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 198*207e5cccSFangrui Song int32_t test_vcvtmh_s32_f16 (float16_t a) { 199*207e5cccSFangrui Song return vcvtmh_s32_f16(a); 200*207e5cccSFangrui Song } 201*207e5cccSFangrui Song 202*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtmh_s64_f16 203*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtms.i64.f16(half %a) 204*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 205*207e5cccSFangrui Song int64_t test_vcvtmh_s64_f16 (float16_t a) { 206*207e5cccSFangrui Song return vcvtmh_s64_f16(a); 207*207e5cccSFangrui Song } 208*207e5cccSFangrui Song 209*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtmh_u16_f16 210*207e5cccSFangrui Song // CHECK: [[FCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtmu.i32.f16(half %a) 211*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FCVT]] to i16 212*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 213*207e5cccSFangrui Song uint16_t test_vcvtmh_u16_f16 (float16_t a) { 214*207e5cccSFangrui Song return vcvtmh_u16_f16(a); 215*207e5cccSFangrui Song } 216*207e5cccSFangrui Song 217*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtmh_u32_f16 218*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtmu.i32.f16(half %a) 219*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 220*207e5cccSFangrui Song uint32_t test_vcvtmh_u32_f16 (float16_t a) { 221*207e5cccSFangrui Song return vcvtmh_u32_f16(a); 222*207e5cccSFangrui Song } 223*207e5cccSFangrui Song 224*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtmh_u64_f16 225*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtmu.i64.f16(half %a) 226*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 227*207e5cccSFangrui Song uint64_t test_vcvtmh_u64_f16 (float16_t a) { 228*207e5cccSFangrui Song return vcvtmh_u64_f16(a); 229*207e5cccSFangrui Song } 230*207e5cccSFangrui Song 231*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtnh_s16_f16 232*207e5cccSFangrui Song // CHECK: [[FCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtns.i32.f16(half %a) 233*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FCVT]] to i16 234*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 235*207e5cccSFangrui Song int16_t test_vcvtnh_s16_f16 (float16_t a) { 236*207e5cccSFangrui Song return vcvtnh_s16_f16(a); 237*207e5cccSFangrui Song } 238*207e5cccSFangrui Song 239*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtnh_s32_f16 240*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtns.i32.f16(half %a) 241*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 242*207e5cccSFangrui Song int32_t test_vcvtnh_s32_f16 (float16_t a) { 243*207e5cccSFangrui Song return vcvtnh_s32_f16(a); 244*207e5cccSFangrui Song } 245*207e5cccSFangrui Song 246*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtnh_s64_f16 247*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtns.i64.f16(half %a) 248*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 249*207e5cccSFangrui Song int64_t test_vcvtnh_s64_f16 (float16_t a) { 250*207e5cccSFangrui Song return vcvtnh_s64_f16(a); 251*207e5cccSFangrui Song } 252*207e5cccSFangrui Song 253*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtnh_u16_f16 254*207e5cccSFangrui Song // CHECK: [[FCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtnu.i32.f16(half %a) 255*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FCVT]] to i16 256*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 257*207e5cccSFangrui Song uint16_t test_vcvtnh_u16_f16 (float16_t a) { 258*207e5cccSFangrui Song return vcvtnh_u16_f16(a); 259*207e5cccSFangrui Song } 260*207e5cccSFangrui Song 261*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtnh_u32_f16 262*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtnu.i32.f16(half %a) 263*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 264*207e5cccSFangrui Song uint32_t test_vcvtnh_u32_f16 (float16_t a) { 265*207e5cccSFangrui Song return vcvtnh_u32_f16(a); 266*207e5cccSFangrui Song } 267*207e5cccSFangrui Song 268*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtnh_u64_f16 269*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtnu.i64.f16(half %a) 270*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 271*207e5cccSFangrui Song uint64_t test_vcvtnh_u64_f16 (float16_t a) { 272*207e5cccSFangrui Song return vcvtnh_u64_f16(a); 273*207e5cccSFangrui Song } 274*207e5cccSFangrui Song 275*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtph_s16_f16 276*207e5cccSFangrui Song // CHECK: [[FCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtps.i32.f16(half %a) 277*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FCVT]] to i16 278*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 279*207e5cccSFangrui Song int16_t test_vcvtph_s16_f16 (float16_t a) { 280*207e5cccSFangrui Song return vcvtph_s16_f16(a); 281*207e5cccSFangrui Song } 282*207e5cccSFangrui Song 283*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtph_s32_f16 284*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtps.i32.f16(half %a) 285*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 286*207e5cccSFangrui Song int32_t test_vcvtph_s32_f16 (float16_t a) { 287*207e5cccSFangrui Song return vcvtph_s32_f16(a); 288*207e5cccSFangrui Song } 289*207e5cccSFangrui Song 290*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtph_s64_f16 291*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtps.i64.f16(half %a) 292*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 293*207e5cccSFangrui Song int64_t test_vcvtph_s64_f16 (float16_t a) { 294*207e5cccSFangrui Song return vcvtph_s64_f16(a); 295*207e5cccSFangrui Song } 296*207e5cccSFangrui Song 297*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtph_u16_f16 298*207e5cccSFangrui Song // CHECK: [[FCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtpu.i32.f16(half %a) 299*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FCVT]] to i16 300*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 301*207e5cccSFangrui Song uint16_t test_vcvtph_u16_f16 (float16_t a) { 302*207e5cccSFangrui Song return vcvtph_u16_f16(a); 303*207e5cccSFangrui Song } 304*207e5cccSFangrui Song 305*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtph_u32_f16 306*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i32 @llvm.aarch64.neon.fcvtpu.i32.f16(half %a) 307*207e5cccSFangrui Song // CHECK: ret i32 [[VCVT]] 308*207e5cccSFangrui Song uint32_t test_vcvtph_u32_f16 (float16_t a) { 309*207e5cccSFangrui Song return vcvtph_u32_f16(a); 310*207e5cccSFangrui Song } 311*207e5cccSFangrui Song 312*207e5cccSFangrui Song // CHECK-LABEL: test_vcvtph_u64_f16 313*207e5cccSFangrui Song // CHECK: [[VCVT:%.*]] = call i64 @llvm.aarch64.neon.fcvtpu.i64.f16(half %a) 314*207e5cccSFangrui Song // CHECK: ret i64 [[VCVT]] 315*207e5cccSFangrui Song uint64_t test_vcvtph_u64_f16 (float16_t a) { 316*207e5cccSFangrui Song return vcvtph_u64_f16(a); 317*207e5cccSFangrui Song } 318*207e5cccSFangrui Song 319*207e5cccSFangrui Song // CHECK-LABEL: test_vnegh_f16 320*207e5cccSFangrui Song // CHECK: [[NEG:%.*]] = fneg half %a 321*207e5cccSFangrui Song // CHECK: ret half [[NEG]] 322*207e5cccSFangrui Song float16_t test_vnegh_f16(float16_t a) { 323*207e5cccSFangrui Song return vnegh_f16(a); 324*207e5cccSFangrui Song } 325*207e5cccSFangrui Song 326*207e5cccSFangrui Song // CHECK-LABEL: test_vrecpeh_f16 327*207e5cccSFangrui Song // CHECK: [[VREC:%.*]] = call half @llvm.aarch64.neon.frecpe.f16(half %a) 328*207e5cccSFangrui Song // CHECK: ret half [[VREC]] 329*207e5cccSFangrui Song float16_t test_vrecpeh_f16(float16_t a) { 330*207e5cccSFangrui Song return vrecpeh_f16(a); 331*207e5cccSFangrui Song } 332*207e5cccSFangrui Song 333*207e5cccSFangrui Song // CHECK-LABEL: test_vrecpxh_f16 334*207e5cccSFangrui Song // CHECK: [[VREC:%.*]] = call half @llvm.aarch64.neon.frecpx.f16(half %a) 335*207e5cccSFangrui Song // CHECK: ret half [[VREC]] 336*207e5cccSFangrui Song float16_t test_vrecpxh_f16(float16_t a) { 337*207e5cccSFangrui Song return vrecpxh_f16(a); 338*207e5cccSFangrui Song } 339*207e5cccSFangrui Song 340*207e5cccSFangrui Song // CHECK-LABEL: test_vrndh_f16 341*207e5cccSFangrui Song // CHECK: [[RND:%.*]] = call half @llvm.trunc.f16(half %a) 342*207e5cccSFangrui Song // CHECK: ret half [[RND]] 343*207e5cccSFangrui Song float16_t test_vrndh_f16(float16_t a) { 344*207e5cccSFangrui Song return vrndh_f16(a); 345*207e5cccSFangrui Song } 346*207e5cccSFangrui Song 347*207e5cccSFangrui Song // CHECK-LABEL: test_vrndah_f16 348*207e5cccSFangrui Song // CHECK: [[RND:%.*]] = call half @llvm.round.f16(half %a) 349*207e5cccSFangrui Song // CHECK: ret half [[RND]] 350*207e5cccSFangrui Song float16_t test_vrndah_f16(float16_t a) { 351*207e5cccSFangrui Song return vrndah_f16(a); 352*207e5cccSFangrui Song } 353*207e5cccSFangrui Song 354*207e5cccSFangrui Song // CHECK-LABEL: test_vrndih_f16 355*207e5cccSFangrui Song // CHECK: [[RND:%.*]] = call half @llvm.nearbyint.f16(half %a) 356*207e5cccSFangrui Song // CHECK: ret half [[RND]] 357*207e5cccSFangrui Song float16_t test_vrndih_f16(float16_t a) { 358*207e5cccSFangrui Song return vrndih_f16(a); 359*207e5cccSFangrui Song } 360*207e5cccSFangrui Song 361*207e5cccSFangrui Song // CHECK-LABEL: test_vrndmh_f16 362*207e5cccSFangrui Song // CHECK: [[RND:%.*]] = call half @llvm.floor.f16(half %a) 363*207e5cccSFangrui Song // CHECK: ret half [[RND]] 364*207e5cccSFangrui Song float16_t test_vrndmh_f16(float16_t a) { 365*207e5cccSFangrui Song return vrndmh_f16(a); 366*207e5cccSFangrui Song } 367*207e5cccSFangrui Song 368*207e5cccSFangrui Song // CHECK-LABEL: test_vrndnh_f16 369*207e5cccSFangrui Song // CHECK: [[RND:%.*]] = call half @llvm.roundeven.f16(half %a) 370*207e5cccSFangrui Song // CHECK: ret half [[RND]] 371*207e5cccSFangrui Song float16_t test_vrndnh_f16(float16_t a) { 372*207e5cccSFangrui Song return vrndnh_f16(a); 373*207e5cccSFangrui Song } 374*207e5cccSFangrui Song 375*207e5cccSFangrui Song // CHECK-LABEL: test_vrndph_f16 376*207e5cccSFangrui Song // CHECK: [[RND:%.*]] = call half @llvm.ceil.f16(half %a) 377*207e5cccSFangrui Song // CHECK: ret half [[RND]] 378*207e5cccSFangrui Song float16_t test_vrndph_f16(float16_t a) { 379*207e5cccSFangrui Song return vrndph_f16(a); 380*207e5cccSFangrui Song } 381*207e5cccSFangrui Song 382*207e5cccSFangrui Song // CHECK-LABEL: test_vrndxh_f16 383*207e5cccSFangrui Song // CHECK: [[RND:%.*]] = call half @llvm.rint.f16(half %a) 384*207e5cccSFangrui Song // CHECK: ret half [[RND]] 385*207e5cccSFangrui Song float16_t test_vrndxh_f16(float16_t a) { 386*207e5cccSFangrui Song return vrndxh_f16(a); 387*207e5cccSFangrui Song } 388*207e5cccSFangrui Song 389*207e5cccSFangrui Song // CHECK-LABEL: test_vrsqrteh_f16 390*207e5cccSFangrui Song // CHECK: [[RND:%.*]] = call half @llvm.aarch64.neon.frsqrte.f16(half %a) 391*207e5cccSFangrui Song // CHECK: ret half [[RND]] 392*207e5cccSFangrui Song float16_t test_vrsqrteh_f16(float16_t a) { 393*207e5cccSFangrui Song return vrsqrteh_f16(a); 394*207e5cccSFangrui Song } 395*207e5cccSFangrui Song 396*207e5cccSFangrui Song // CHECK-LABEL: test_vsqrth_f16 397*207e5cccSFangrui Song // CHECK: [[SQR:%.*]] = call half @llvm.sqrt.f16(half %a) 398*207e5cccSFangrui Song // CHECK: ret half [[SQR]] 399*207e5cccSFangrui Song float16_t test_vsqrth_f16(float16_t a) { 400*207e5cccSFangrui Song return vsqrth_f16(a); 401*207e5cccSFangrui Song } 402*207e5cccSFangrui Song 403*207e5cccSFangrui Song // CHECK-LABEL: test_vaddh_f16 404*207e5cccSFangrui Song // CHECK: [[ADD:%.*]] = fadd half %a, %b 405*207e5cccSFangrui Song // CHECK: ret half [[ADD]] 406*207e5cccSFangrui Song float16_t test_vaddh_f16(float16_t a, float16_t b) { 407*207e5cccSFangrui Song return vaddh_f16(a, b); 408*207e5cccSFangrui Song } 409*207e5cccSFangrui Song 410*207e5cccSFangrui Song // CHECK-LABEL: test_vabdh_f16 411*207e5cccSFangrui Song // CHECK: [[ABD:%.*]] = call half @llvm.aarch64.sisd.fabd.f16(half %a, half %b) 412*207e5cccSFangrui Song // CHECK: ret half [[ABD]] 413*207e5cccSFangrui Song float16_t test_vabdh_f16(float16_t a, float16_t b) { 414*207e5cccSFangrui Song return vabdh_f16(a, b); 415*207e5cccSFangrui Song } 416*207e5cccSFangrui Song 417*207e5cccSFangrui Song // CHECK-LABEL: test_vcageh_f16 418*207e5cccSFangrui Song // CHECK: [[FACG:%.*]] = call i32 @llvm.aarch64.neon.facge.i32.f16(half %a, half %b) 419*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FACG]] to i16 420*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 421*207e5cccSFangrui Song uint16_t test_vcageh_f16(float16_t a, float16_t b) { 422*207e5cccSFangrui Song return vcageh_f16(a, b); 423*207e5cccSFangrui Song } 424*207e5cccSFangrui Song 425*207e5cccSFangrui Song // CHECK-LABEL: test_vcagth_f16 426*207e5cccSFangrui Song // CHECK: [[FACG:%.*]] = call i32 @llvm.aarch64.neon.facgt.i32.f16(half %a, half %b) 427*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FACG]] to i16 428*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 429*207e5cccSFangrui Song uint16_t test_vcagth_f16(float16_t a, float16_t b) { 430*207e5cccSFangrui Song return vcagth_f16(a, b); 431*207e5cccSFangrui Song } 432*207e5cccSFangrui Song 433*207e5cccSFangrui Song // CHECK-LABEL: test_vcaleh_f16 434*207e5cccSFangrui Song // CHECK: [[FACG:%.*]] = call i32 @llvm.aarch64.neon.facge.i32.f16(half %b, half %a) 435*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FACG]] to i16 436*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 437*207e5cccSFangrui Song uint16_t test_vcaleh_f16(float16_t a, float16_t b) { 438*207e5cccSFangrui Song return vcaleh_f16(a, b); 439*207e5cccSFangrui Song } 440*207e5cccSFangrui Song 441*207e5cccSFangrui Song // CHECK-LABEL: test_vcalth_f16 442*207e5cccSFangrui Song // CHECK: [[FACG:%.*]] = call i32 @llvm.aarch64.neon.facgt.i32.f16(half %b, half %a) 443*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[FACG]] to i16 444*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 445*207e5cccSFangrui Song uint16_t test_vcalth_f16(float16_t a, float16_t b) { 446*207e5cccSFangrui Song return vcalth_f16(a, b); 447*207e5cccSFangrui Song } 448*207e5cccSFangrui Song 449*207e5cccSFangrui Song // CHECK-LABEL: test_vceqh_f16 450*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp oeq half %a, %b 451*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 452*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 453*207e5cccSFangrui Song uint16_t test_vceqh_f16(float16_t a, float16_t b) { 454*207e5cccSFangrui Song return vceqh_f16(a, b); 455*207e5cccSFangrui Song } 456*207e5cccSFangrui Song 457*207e5cccSFangrui Song // CHECK-LABEL: test_vcgeh_f16 458*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp oge half %a, %b 459*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 460*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 461*207e5cccSFangrui Song uint16_t test_vcgeh_f16(float16_t a, float16_t b) { 462*207e5cccSFangrui Song return vcgeh_f16(a, b); 463*207e5cccSFangrui Song } 464*207e5cccSFangrui Song 465*207e5cccSFangrui Song // CHECK-LABEL: test_vcgth_f16 466*207e5cccSFangrui Song //CHECK: [[TMP1:%.*]] = fcmp ogt half %a, %b 467*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 468*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 469*207e5cccSFangrui Song uint16_t test_vcgth_f16(float16_t a, float16_t b) { 470*207e5cccSFangrui Song return vcgth_f16(a, b); 471*207e5cccSFangrui Song } 472*207e5cccSFangrui Song 473*207e5cccSFangrui Song // CHECK-LABEL: test_vcleh_f16 474*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp ole half %a, %b 475*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 476*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 477*207e5cccSFangrui Song uint16_t test_vcleh_f16(float16_t a, float16_t b) { 478*207e5cccSFangrui Song return vcleh_f16(a, b); 479*207e5cccSFangrui Song } 480*207e5cccSFangrui Song 481*207e5cccSFangrui Song // CHECK-LABEL: test_vclth_f16 482*207e5cccSFangrui Song // CHECK: [[TMP1:%.*]] = fcmp olt half %a, %b 483*207e5cccSFangrui Song // CHECK: [[TMP2:%.*]] = sext i1 [[TMP1]] to i16 484*207e5cccSFangrui Song // CHECK: ret i16 [[TMP2]] 485*207e5cccSFangrui Song uint16_t test_vclth_f16(float16_t a, float16_t b) { 486*207e5cccSFangrui Song return vclth_f16(a, b); 487*207e5cccSFangrui Song } 488*207e5cccSFangrui Song 489*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_f16_s16 490*207e5cccSFangrui Song // CHECK: [[SEXT:%.*]] = sext i16 %a to i32 491*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call half @llvm.aarch64.neon.vcvtfxs2fp.f16.i32(i32 [[SEXT]], i32 1) 492*207e5cccSFangrui Song // CHECK: ret half [[CVT]] 493*207e5cccSFangrui Song float16_t test_vcvth_n_f16_s16(int16_t a) { 494*207e5cccSFangrui Song return vcvth_n_f16_s16(a, 1); 495*207e5cccSFangrui Song } 496*207e5cccSFangrui Song 497*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_f16_s32 498*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call half @llvm.aarch64.neon.vcvtfxs2fp.f16.i32(i32 %a, i32 1) 499*207e5cccSFangrui Song // CHECK: ret half [[CVT]] 500*207e5cccSFangrui Song float16_t test_vcvth_n_f16_s32(int32_t a) { 501*207e5cccSFangrui Song return vcvth_n_f16_s32(a, 1); 502*207e5cccSFangrui Song } 503*207e5cccSFangrui Song 504*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_f16_s64 505*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call half @llvm.aarch64.neon.vcvtfxs2fp.f16.i64(i64 %a, i32 1) 506*207e5cccSFangrui Song // CHECK: ret half [[CVT]] 507*207e5cccSFangrui Song float16_t test_vcvth_n_f16_s64(int64_t a) { 508*207e5cccSFangrui Song return vcvth_n_f16_s64(a, 1); 509*207e5cccSFangrui Song } 510*207e5cccSFangrui Song 511*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_s16_f16 512*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call i32 @llvm.aarch64.neon.vcvtfp2fxs.i32.f16(half %a, i32 1) 513*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[CVT]] to i16 514*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 515*207e5cccSFangrui Song int16_t test_vcvth_n_s16_f16(float16_t a) { 516*207e5cccSFangrui Song return vcvth_n_s16_f16(a, 1); 517*207e5cccSFangrui Song } 518*207e5cccSFangrui Song 519*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_s32_f16 520*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call i32 @llvm.aarch64.neon.vcvtfp2fxs.i32.f16(half %a, i32 1) 521*207e5cccSFangrui Song // CHECK: ret i32 [[CVT]] 522*207e5cccSFangrui Song int32_t test_vcvth_n_s32_f16(float16_t a) { 523*207e5cccSFangrui Song return vcvth_n_s32_f16(a, 1); 524*207e5cccSFangrui Song } 525*207e5cccSFangrui Song 526*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_s64_f16 527*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call i64 @llvm.aarch64.neon.vcvtfp2fxs.i64.f16(half %a, i32 1) 528*207e5cccSFangrui Song // CHECK: ret i64 [[CVT]] 529*207e5cccSFangrui Song int64_t test_vcvth_n_s64_f16(float16_t a) { 530*207e5cccSFangrui Song return vcvth_n_s64_f16(a, 1); 531*207e5cccSFangrui Song } 532*207e5cccSFangrui Song 533*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_f16_u16 534*207e5cccSFangrui Song // CHECK: [[SEXT:%.*]] = zext i16 %a to i32 535*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call half @llvm.aarch64.neon.vcvtfxu2fp.f16.i32(i32 [[SEXT]], i32 1) 536*207e5cccSFangrui Song // CHECK: ret half [[CVT]] 537*207e5cccSFangrui Song float16_t test_vcvth_n_f16_u16(int16_t a) { 538*207e5cccSFangrui Song return vcvth_n_f16_u16(a, 1); 539*207e5cccSFangrui Song } 540*207e5cccSFangrui Song 541*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_f16_u32 542*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call half @llvm.aarch64.neon.vcvtfxu2fp.f16.i32(i32 %a, i32 1) 543*207e5cccSFangrui Song // CHECK: ret half [[CVT]] 544*207e5cccSFangrui Song float16_t test_vcvth_n_f16_u32(int32_t a) { 545*207e5cccSFangrui Song return vcvth_n_f16_u32(a, 1); 546*207e5cccSFangrui Song } 547*207e5cccSFangrui Song 548*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_f16_u64 549*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call half @llvm.aarch64.neon.vcvtfxu2fp.f16.i64(i64 %a, i32 1) 550*207e5cccSFangrui Song // CHECK: ret half [[CVT]] 551*207e5cccSFangrui Song float16_t test_vcvth_n_f16_u64(int64_t a) { 552*207e5cccSFangrui Song return vcvth_n_f16_u64(a, 1); 553*207e5cccSFangrui Song } 554*207e5cccSFangrui Song 555*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_u16_f16 556*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call i32 @llvm.aarch64.neon.vcvtfp2fxu.i32.f16(half %a, i32 1) 557*207e5cccSFangrui Song // CHECK: [[RET:%.*]] = trunc i32 [[CVT]] to i16 558*207e5cccSFangrui Song // CHECK: ret i16 [[RET]] 559*207e5cccSFangrui Song int16_t test_vcvth_n_u16_f16(float16_t a) { 560*207e5cccSFangrui Song return vcvth_n_u16_f16(a, 1); 561*207e5cccSFangrui Song } 562*207e5cccSFangrui Song 563*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_u32_f16 564*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call i32 @llvm.aarch64.neon.vcvtfp2fxu.i32.f16(half %a, i32 1) 565*207e5cccSFangrui Song // CHECK: ret i32 [[CVT]] 566*207e5cccSFangrui Song int32_t test_vcvth_n_u32_f16(float16_t a) { 567*207e5cccSFangrui Song return vcvth_n_u32_f16(a, 1); 568*207e5cccSFangrui Song } 569*207e5cccSFangrui Song 570*207e5cccSFangrui Song // CHECK-LABEL: test_vcvth_n_u64_f16 571*207e5cccSFangrui Song // CHECK: [[CVT:%.*]] = call i64 @llvm.aarch64.neon.vcvtfp2fxu.i64.f16(half %a, i32 1) 572*207e5cccSFangrui Song // CHECK: ret i64 [[CVT]] 573*207e5cccSFangrui Song int64_t test_vcvth_n_u64_f16(float16_t a) { 574*207e5cccSFangrui Song return vcvth_n_u64_f16(a, 1); 575*207e5cccSFangrui Song } 576*207e5cccSFangrui Song 577*207e5cccSFangrui Song // CHECK-LABEL: test_vdivh_f16 578*207e5cccSFangrui Song // CHECK: [[DIV:%.*]] = fdiv half %a, %b 579*207e5cccSFangrui Song // CHECK: ret half [[DIV]] 580*207e5cccSFangrui Song float16_t test_vdivh_f16(float16_t a, float16_t b) { 581*207e5cccSFangrui Song return vdivh_f16(a, b); 582*207e5cccSFangrui Song } 583*207e5cccSFangrui Song 584*207e5cccSFangrui Song // CHECK-LABEL: test_vmaxh_f16 585*207e5cccSFangrui Song // CHECK: [[MAX:%.*]] = call half @llvm.aarch64.neon.fmax.f16(half %a, half %b) 586*207e5cccSFangrui Song // CHECK: ret half [[MAX]] 587*207e5cccSFangrui Song float16_t test_vmaxh_f16(float16_t a, float16_t b) { 588*207e5cccSFangrui Song return vmaxh_f16(a, b); 589*207e5cccSFangrui Song } 590*207e5cccSFangrui Song 591*207e5cccSFangrui Song // CHECK-LABEL: test_vmaxnmh_f16 592*207e5cccSFangrui Song // CHECK: [[MAX:%.*]] = call half @llvm.aarch64.neon.fmaxnm.f16(half %a, half %b) 593*207e5cccSFangrui Song // CHECK: ret half [[MAX]] 594*207e5cccSFangrui Song float16_t test_vmaxnmh_f16(float16_t a, float16_t b) { 595*207e5cccSFangrui Song return vmaxnmh_f16(a, b); 596*207e5cccSFangrui Song } 597*207e5cccSFangrui Song 598*207e5cccSFangrui Song // CHECK-LABEL: test_vminh_f16 599*207e5cccSFangrui Song // CHECK: [[MIN:%.*]] = call half @llvm.aarch64.neon.fmin.f16(half %a, half %b) 600*207e5cccSFangrui Song // CHECK: ret half [[MIN]] 601*207e5cccSFangrui Song float16_t test_vminh_f16(float16_t a, float16_t b) { 602*207e5cccSFangrui Song return vminh_f16(a, b); 603*207e5cccSFangrui Song } 604*207e5cccSFangrui Song 605*207e5cccSFangrui Song // CHECK-LABEL: test_vminnmh_f16 606*207e5cccSFangrui Song // CHECK: [[MIN:%.*]] = call half @llvm.aarch64.neon.fminnm.f16(half %a, half %b) 607*207e5cccSFangrui Song // CHECK: ret half [[MIN]] 608*207e5cccSFangrui Song float16_t test_vminnmh_f16(float16_t a, float16_t b) { 609*207e5cccSFangrui Song return vminnmh_f16(a, b); 610*207e5cccSFangrui Song } 611*207e5cccSFangrui Song 612*207e5cccSFangrui Song // CHECK-LABEL: test_vmulh_f16 613*207e5cccSFangrui Song // CHECK: [[MUL:%.*]] = fmul half %a, %b 614*207e5cccSFangrui Song // CHECK: ret half [[MUL]] 615*207e5cccSFangrui Song float16_t test_vmulh_f16(float16_t a, float16_t b) { 616*207e5cccSFangrui Song return vmulh_f16(a, b); 617*207e5cccSFangrui Song } 618*207e5cccSFangrui Song 619*207e5cccSFangrui Song // CHECK-LABEL: test_vmulxh_f16 620*207e5cccSFangrui Song // CHECK: [[MUL:%.*]] = call half @llvm.aarch64.neon.fmulx.f16(half %a, half %b) 621*207e5cccSFangrui Song // CHECK: ret half [[MUL]] 622*207e5cccSFangrui Song float16_t test_vmulxh_f16(float16_t a, float16_t b) { 623*207e5cccSFangrui Song return vmulxh_f16(a, b); 624*207e5cccSFangrui Song } 625*207e5cccSFangrui Song 626*207e5cccSFangrui Song // CHECK-LABEL: test_vrecpsh_f16 627*207e5cccSFangrui Song // CHECK: [[RECPS:%.*]] = call half @llvm.aarch64.neon.frecps.f16(half %a, half %b) 628*207e5cccSFangrui Song // CHECK: ret half [[RECPS]] 629*207e5cccSFangrui Song float16_t test_vrecpsh_f16(float16_t a, float16_t b) { 630*207e5cccSFangrui Song return vrecpsh_f16(a, b); 631*207e5cccSFangrui Song } 632*207e5cccSFangrui Song 633*207e5cccSFangrui Song // CHECK-LABEL: test_vrsqrtsh_f16 634*207e5cccSFangrui Song // CHECK: [[RSQRTS:%.*]] = call half @llvm.aarch64.neon.frsqrts.f16(half %a, half %b) 635*207e5cccSFangrui Song // CHECK: ret half [[RSQRTS]] 636*207e5cccSFangrui Song float16_t test_vrsqrtsh_f16(float16_t a, float16_t b) { 637*207e5cccSFangrui Song return vrsqrtsh_f16(a, b); 638*207e5cccSFangrui Song } 639*207e5cccSFangrui Song 640*207e5cccSFangrui Song // CHECK-LABEL: test_vsubh_f16 641*207e5cccSFangrui Song // CHECK: [[SUB:%.*]] = fsub half %a, %b 642*207e5cccSFangrui Song // CHECK: ret half [[SUB]] 643*207e5cccSFangrui Song float16_t test_vsubh_f16(float16_t a, float16_t b) { 644*207e5cccSFangrui Song return vsubh_f16(a, b); 645*207e5cccSFangrui Song } 646*207e5cccSFangrui Song 647*207e5cccSFangrui Song // CHECK-LABEL: test_vfmah_f16 648*207e5cccSFangrui Song // CHECK: [[FMA:%.*]] = call half @llvm.fma.f16(half %b, half %c, half %a) 649*207e5cccSFangrui Song // CHECK: ret half [[FMA]] 650*207e5cccSFangrui Song float16_t test_vfmah_f16(float16_t a, float16_t b, float16_t c) { 651*207e5cccSFangrui Song return vfmah_f16(a, b, c); 652*207e5cccSFangrui Song } 653*207e5cccSFangrui Song 654*207e5cccSFangrui Song // CHECK-LABEL: test_vfmsh_f16 655*207e5cccSFangrui Song // CHECK: [[SUB:%.*]] = fneg half %b 656*207e5cccSFangrui Song // CHECK: [[ADD:%.*]] = call half @llvm.fma.f16(half [[SUB]], half %c, half %a) 657*207e5cccSFangrui Song // CHECK: ret half [[ADD]] 658*207e5cccSFangrui Song float16_t test_vfmsh_f16(float16_t a, float16_t b, float16_t c) { 659*207e5cccSFangrui Song return vfmsh_f16(a, b, c); 660*207e5cccSFangrui Song } 661*207e5cccSFangrui Song 662