1*67e74705SXin Li // RUN: %clang_cc1 -triple thumbv7-none-linux-gnueabihf \
2*67e74705SXin Li // RUN: -target-abi aapcs \
3*67e74705SXin Li // RUN: -target-cpu cortex-a7 \
4*67e74705SXin Li // RUN: -mfloat-abi hard \
5*67e74705SXin Li // RUN: -ffreestanding \
6*67e74705SXin Li // RUN: -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
7*67e74705SXin Li
8*67e74705SXin Li #include <arm_neon.h>
9*67e74705SXin Li
10*67e74705SXin Li // CHECK-LABEL: define <2 x float> @test_fma_order(<2 x float> %accum, <2 x float> %lhs, <2 x float> %rhs) #0 {
11*67e74705SXin Li // CHECK: [[TMP0:%.*]] = bitcast <2 x float> %accum to <8 x i8>
12*67e74705SXin Li // CHECK: [[TMP1:%.*]] = bitcast <2 x float> %lhs to <8 x i8>
13*67e74705SXin Li // CHECK: [[TMP2:%.*]] = bitcast <2 x float> %rhs to <8 x i8>
14*67e74705SXin Li // CHECK: [[TMP3:%.*]] = bitcast <8 x i8> [[TMP0]] to <2 x float>
15*67e74705SXin Li // CHECK: [[TMP4:%.*]] = bitcast <8 x i8> [[TMP1]] to <2 x float>
16*67e74705SXin Li // CHECK: [[TMP5:%.*]] = bitcast <8 x i8> [[TMP2]] to <2 x float>
17*67e74705SXin Li // CHECK: [[TMP6:%.*]] = call <2 x float> @llvm.fma.v2f32(<2 x float> [[TMP4]], <2 x float> [[TMP5]], <2 x float> [[TMP3]]) #2
18*67e74705SXin Li // CHECK: ret <2 x float> [[TMP6]]
test_fma_order(float32x2_t accum,float32x2_t lhs,float32x2_t rhs)19*67e74705SXin Li float32x2_t test_fma_order(float32x2_t accum, float32x2_t lhs, float32x2_t rhs) {
20*67e74705SXin Li return vfma_f32(accum, lhs, rhs);
21*67e74705SXin Li }
22*67e74705SXin Li
23*67e74705SXin Li // CHECK-LABEL: define <4 x float> @test_fmaq_order(<4 x float> %accum, <4 x float> %lhs, <4 x float> %rhs) #0 {
24*67e74705SXin Li // CHECK: [[TMP0:%.*]] = bitcast <4 x float> %accum to <16 x i8>
25*67e74705SXin Li // CHECK: [[TMP1:%.*]] = bitcast <4 x float> %lhs to <16 x i8>
26*67e74705SXin Li // CHECK: [[TMP2:%.*]] = bitcast <4 x float> %rhs to <16 x i8>
27*67e74705SXin Li // CHECK: [[TMP3:%.*]] = bitcast <16 x i8> [[TMP0]] to <4 x float>
28*67e74705SXin Li // CHECK: [[TMP4:%.*]] = bitcast <16 x i8> [[TMP1]] to <4 x float>
29*67e74705SXin Li // CHECK: [[TMP5:%.*]] = bitcast <16 x i8> [[TMP2]] to <4 x float>
30*67e74705SXin Li // CHECK: [[TMP6:%.*]] = call <4 x float> @llvm.fma.v4f32(<4 x float> [[TMP4]], <4 x float> [[TMP5]], <4 x float> [[TMP3]]) #2
31*67e74705SXin Li // CHECK: ret <4 x float> [[TMP6]]
test_fmaq_order(float32x4_t accum,float32x4_t lhs,float32x4_t rhs)32*67e74705SXin Li float32x4_t test_fmaq_order(float32x4_t accum, float32x4_t lhs, float32x4_t rhs) {
33*67e74705SXin Li return vfmaq_f32(accum, lhs, rhs);
34*67e74705SXin Li }
35