|
| 1 | +// RUN: %clang_cc1 -triple powerpc64le-gnu-linux \ |
| 2 | +// RUN: -target-feature +altivec -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck \ |
| 3 | +// RUN: %s |
| 4 | + |
| 5 | +typedef __attribute__((vector_size(4 * sizeof(float)))) float vec_float; |
| 6 | +typedef __attribute__((vector_size(2 * sizeof(double)))) double vec_double; |
| 7 | + |
| 8 | +volatile vec_double vd; |
| 9 | +volatile vec_float vf; |
| 10 | + |
| 11 | +void 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: fneg <2 x double> [[RESULT]] |
| 32 | + // CHECK: [[RESULT:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}}) |
| 33 | + |
| 34 | + vf = __builtin_vsx_xvnmsubasp(vf, vf, vf); |
| 35 | + // CHECK: [[RESULT:%[^ ]+]] = fneg <4 x float> %{{.*}} |
| 36 | + // CHECK: [[RESULT2:%[^ ]+]] = call <4 x float> @llvm.fma.v2f64(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[RESULT]]) |
| 37 | + // CHECK: fneg <4 x float> [[RESULT2]] |
| 38 | + |
| 39 | + vd = __builtin_vsx_xvnmsubadp(vd, vd, vd); |
| 40 | + // CHECK: [[RESULT:%[^ ]+]] = fneg <2 x double> %{{.*}} |
| 41 | + // CHECK: [[RESULT2:%[^ ]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[RESULT]]) |
| 42 | + // CHECK: fneg <2 x double> [[RESULT2]] |
| 43 | +} |
0 commit comments