40 lines · c
1// RUN: %clang_cc1 -triple powerpc64le-gnu-linux \2// RUN: -target-feature +vsx -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck \3// RUN: %s4 5typedef __attribute__((vector_size(4 * sizeof(float)))) float vec_float;6typedef __attribute__((vector_size(2 * sizeof(double)))) double vec_double;7 8volatile vec_double vd;9volatile vec_float vf;10 11void test_fma(void) {12 vf = __builtin_vsx_xvmaddasp(vf, vf, vf);13 // CHECK: @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})14 15 vd = __builtin_vsx_xvmaddadp(vd, vd, vd);16 // CHECK: @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})17 18 vf = __builtin_vsx_xvnmaddasp(vf, vf, vf);19 // CHECK: [[RESULT:%[^ ]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})20 // CHECK: fneg <4 x float> [[RESULT]]21 22 vd = __builtin_vsx_xvnmaddadp(vd, vd, vd);23 // CHECK: [[RESULT:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})24 // CHECK: fneg <2 x double> [[RESULT]]25 26 vf = __builtin_vsx_xvmsubasp(vf, vf, vf);27 // CHECK: [[RESULT:%[^ ]+]] = fneg <4 x float> %{{.*}}28 // CHECK: @llvm.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[RESULT]])29 30 vd = __builtin_vsx_xvmsubadp(vd, vd, vd);31 // CHECK: [[RESULT:%[^ ]+]] = fneg <2 x double> %{{.*}}32 // CHECK: <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[RESULT]])33 34 vf = __builtin_vsx_xvnmsubasp(vf, vf, vf);35 // CHECK: call <4 x float> @llvm.ppc.fnmsub.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}})36 37 vd = __builtin_vsx_xvnmsubadp(vd, vd, vd);38 // CHECK: call <2 x double> @llvm.ppc.fnmsub.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})39}40