1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -O1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc // Test ARM64 SIMD fused multiply add intrinsics
4*0a6a1f1dSLionel Sambuc
5*0a6a1f1dSLionel Sambuc #include <arm_neon.h>
6*0a6a1f1dSLionel Sambuc
test_vabsq_s64(int64x2_t a1)7*0a6a1f1dSLionel Sambuc int64x2_t test_vabsq_s64(int64x2_t a1) {
8*0a6a1f1dSLionel Sambuc // CHECK: test_vabsq_s64
9*0a6a1f1dSLionel Sambuc return vabsq_s64(a1);
10*0a6a1f1dSLionel Sambuc // CHECK: llvm.aarch64.neon.abs.v2i64
11*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret
12*0a6a1f1dSLionel Sambuc }
13*0a6a1f1dSLionel Sambuc
test_vceqd_s64(int64_t a1,int64_t a2)14*0a6a1f1dSLionel Sambuc int64_t test_vceqd_s64(int64_t a1, int64_t a2) {
15*0a6a1f1dSLionel Sambuc // CHECK: test_vceqd_s64
16*0a6a1f1dSLionel Sambuc return vceqd_s64(a1, a2);
17*0a6a1f1dSLionel Sambuc // CHECK: [[BIT:%[0-9a-zA-Z.]+]] = icmp eq i64 %a1, %a2
18*0a6a1f1dSLionel Sambuc // CHECK: sext i1 [[BIT]] to i64
19*0a6a1f1dSLionel Sambuc }
20*0a6a1f1dSLionel Sambuc
test_vceqd_f64(float64_t a1,float64_t a2)21*0a6a1f1dSLionel Sambuc int64_t test_vceqd_f64(float64_t a1, float64_t a2) {
22*0a6a1f1dSLionel Sambuc // CHECK: test_vceqd_f64
23*0a6a1f1dSLionel Sambuc return vceqd_f64(a1, a2);
24*0a6a1f1dSLionel Sambuc // CHECK: [[BIT:%[0-9a-zA-Z.]+]] = fcmp oeq double %a1, %a2
25*0a6a1f1dSLionel Sambuc // CHECK: sext i1 [[BIT]] to i64
26*0a6a1f1dSLionel Sambuc }
27*0a6a1f1dSLionel Sambuc
test_vcgtd_u64(uint64_t a1,uint64_t a2)28*0a6a1f1dSLionel Sambuc uint64_t test_vcgtd_u64(uint64_t a1, uint64_t a2) {
29*0a6a1f1dSLionel Sambuc // CHECK: test_vcgtd_u64
30*0a6a1f1dSLionel Sambuc return vcgtd_u64(a1, a2);
31*0a6a1f1dSLionel Sambuc // CHECK: [[BIT:%[0-9a-zA-Z.]+]] = icmp ugt i64 %a1, %a2
32*0a6a1f1dSLionel Sambuc // CHECK: sext i1 [[BIT]] to i64
33*0a6a1f1dSLionel Sambuc }
34*0a6a1f1dSLionel Sambuc
test_vcled_u64(uint64_t a1,uint64_t a2)35*0a6a1f1dSLionel Sambuc uint64_t test_vcled_u64(uint64_t a1, uint64_t a2) {
36*0a6a1f1dSLionel Sambuc // CHECK: test_vcled_u64
37*0a6a1f1dSLionel Sambuc return vcled_u64(a1, a2);
38*0a6a1f1dSLionel Sambuc // CHECK: [[BIT:%[0-9a-zA-Z.]+]] = icmp ule i64 %a1, %a2
39*0a6a1f1dSLionel Sambuc // CHECK: sext i1 [[BIT]] to i64
40*0a6a1f1dSLionel Sambuc }
41*0a6a1f1dSLionel Sambuc
test_vceqzd_s64(int64_t a1)42*0a6a1f1dSLionel Sambuc int64_t test_vceqzd_s64(int64_t a1) {
43*0a6a1f1dSLionel Sambuc // CHECK: test_vceqzd_s64
44*0a6a1f1dSLionel Sambuc return vceqzd_s64(a1);
45*0a6a1f1dSLionel Sambuc // CHECK: [[BIT:%[0-9a-zA-Z.]+]] = icmp eq i64 %a1, 0
46*0a6a1f1dSLionel Sambuc // CHECK: sext i1 [[BIT]] to i64
47*0a6a1f1dSLionel Sambuc }
48*0a6a1f1dSLionel Sambuc
test_vceqq_u64(uint64x2_t a1,uint64x2_t a2)49*0a6a1f1dSLionel Sambuc uint64x2_t test_vceqq_u64(uint64x2_t a1, uint64x2_t a2) {
50*0a6a1f1dSLionel Sambuc // CHECK: test_vceqq_u64
51*0a6a1f1dSLionel Sambuc return vceqq_u64(a1, a2);
52*0a6a1f1dSLionel Sambuc // CHECK: icmp eq <2 x i64> %a1, %a2
53*0a6a1f1dSLionel Sambuc }
54*0a6a1f1dSLionel Sambuc
test_vcgeq_s64(int64x2_t a1,int64x2_t a2)55*0a6a1f1dSLionel Sambuc uint64x2_t test_vcgeq_s64(int64x2_t a1, int64x2_t a2) {
56*0a6a1f1dSLionel Sambuc // CHECK: test_vcgeq_s64
57*0a6a1f1dSLionel Sambuc return vcgeq_s64(a1, a2);
58*0a6a1f1dSLionel Sambuc // CHECK: icmp sge <2 x i64> %a1, %a2
59*0a6a1f1dSLionel Sambuc }
60*0a6a1f1dSLionel Sambuc
test_vcgeq_u64(uint64x2_t a1,uint64x2_t a2)61*0a6a1f1dSLionel Sambuc uint64x2_t test_vcgeq_u64(uint64x2_t a1, uint64x2_t a2) {
62*0a6a1f1dSLionel Sambuc // CHECK: test_vcgeq_u64
63*0a6a1f1dSLionel Sambuc return vcgeq_u64(a1, a2);
64*0a6a1f1dSLionel Sambuc // CHECK: icmp uge <2 x i64> %a1, %a2
65*0a6a1f1dSLionel Sambuc }
66*0a6a1f1dSLionel Sambuc
test_vcgtq_s64(int64x2_t a1,int64x2_t a2)67*0a6a1f1dSLionel Sambuc uint64x2_t test_vcgtq_s64(int64x2_t a1, int64x2_t a2) {
68*0a6a1f1dSLionel Sambuc // CHECK: test_vcgtq_s64
69*0a6a1f1dSLionel Sambuc return vcgtq_s64(a1, a2);
70*0a6a1f1dSLionel Sambuc // CHECK: icmp sgt <2 x i64> %a1, %a2
71*0a6a1f1dSLionel Sambuc }
72*0a6a1f1dSLionel Sambuc
test_vcgtq_u64(uint64x2_t a1,uint64x2_t a2)73*0a6a1f1dSLionel Sambuc uint64x2_t test_vcgtq_u64(uint64x2_t a1, uint64x2_t a2) {
74*0a6a1f1dSLionel Sambuc // CHECK: test_vcgtq_u64
75*0a6a1f1dSLionel Sambuc return vcgtq_u64(a1, a2);
76*0a6a1f1dSLionel Sambuc // CHECK: icmp ugt <2 x i64> %a1, %a2
77*0a6a1f1dSLionel Sambuc }
78*0a6a1f1dSLionel Sambuc
test_vcleq_s64(int64x2_t a1,int64x2_t a2)79*0a6a1f1dSLionel Sambuc uint64x2_t test_vcleq_s64(int64x2_t a1, int64x2_t a2) {
80*0a6a1f1dSLionel Sambuc // CHECK: test_vcleq_s64
81*0a6a1f1dSLionel Sambuc return vcleq_s64(a1, a2);
82*0a6a1f1dSLionel Sambuc // CHECK: icmp sle <2 x i64> %a1, %a2
83*0a6a1f1dSLionel Sambuc }
84*0a6a1f1dSLionel Sambuc
test_vcleq_u64(uint64x2_t a1,uint64x2_t a2)85*0a6a1f1dSLionel Sambuc uint64x2_t test_vcleq_u64(uint64x2_t a1, uint64x2_t a2) {
86*0a6a1f1dSLionel Sambuc // CHECK: test_vcleq_u64
87*0a6a1f1dSLionel Sambuc return vcleq_u64(a1, a2);
88*0a6a1f1dSLionel Sambuc // CHECK: icmp ule <2 x i64> %a1, %a2
89*0a6a1f1dSLionel Sambuc }
90*0a6a1f1dSLionel Sambuc
test_vcltq_s64(int64x2_t a1,int64x2_t a2)91*0a6a1f1dSLionel Sambuc uint64x2_t test_vcltq_s64(int64x2_t a1, int64x2_t a2) {
92*0a6a1f1dSLionel Sambuc // CHECK: test_vcltq_s64
93*0a6a1f1dSLionel Sambuc return vcltq_s64(a1, a2);
94*0a6a1f1dSLionel Sambuc // CHECK: icmp slt <2 x i64> %a1, %a2
95*0a6a1f1dSLionel Sambuc }
96*0a6a1f1dSLionel Sambuc
test_vcltq_u64(uint64x2_t a1,uint64x2_t a2)97*0a6a1f1dSLionel Sambuc uint64x2_t test_vcltq_u64(uint64x2_t a1, uint64x2_t a2) {
98*0a6a1f1dSLionel Sambuc // CHECK: test_vcltq_u64
99*0a6a1f1dSLionel Sambuc return vcltq_u64(a1, a2);
100*0a6a1f1dSLionel Sambuc // CHECK: icmp ult <2 x i64> %a1, %a2
101*0a6a1f1dSLionel Sambuc }
102*0a6a1f1dSLionel Sambuc
test_vqabsq_s64(int64x2_t a1)103*0a6a1f1dSLionel Sambuc int64x2_t test_vqabsq_s64(int64x2_t a1) {
104*0a6a1f1dSLionel Sambuc // CHECK: test_vqabsq_s64
105*0a6a1f1dSLionel Sambuc return vqabsq_s64(a1);
106*0a6a1f1dSLionel Sambuc // CHECK: llvm.aarch64.neon.sqabs.v2i64(<2 x i64> %a1)
107*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret
108*0a6a1f1dSLionel Sambuc }
109