1 // RUN: %clang_cc1 -triple hexagon -target-cpu hexagonv66 -target-feature +hvxv66 -target-feature +hvx-length64b -emit-llvm -o - %s | FileCheck %s
2 // REQUIRES: hexagon-registered-target
5 // CHECK: call i32 @llvm.hexagon.M2.mnaci(i32 %0, i32 %1, i32 %2)
6 int test1(int rx
, int rs
, int rt
) {
7 return __builtin_HEXAGON_M2_mnaci(rx
, rs
, rt
);
10 // CHECK-LABEL: @test2
11 // CHECK: call double @llvm.hexagon.F2.dfadd(double %0, double %1)
12 double test2(double rss
, double rtt
) {
13 return __builtin_HEXAGON_F2_dfadd(rss
, rtt
);
16 // CHECK-LABEL: @test3
17 // CHECK: call double @llvm.hexagon.F2.dfsub(double %0, double %1)
18 double test3(double rss
, double rtt
) {
19 return __builtin_HEXAGON_F2_dfsub(rss
, rtt
);
22 // CHECK-LABEL: @test4
23 // CHECK: call i32 @llvm.hexagon.S2.mask(i32 1, i32 2)
25 return __builtin_HEXAGON_S2_mask(1, 2);
28 typedef long HEXAGON_VecPred64
__attribute__((__vector_size__(64)))
29 __attribute__((aligned(64)));
30 typedef long HEXAGON_Vect512
__attribute__((__vector_size__(64)))
31 __attribute__((aligned(64)));
32 typedef long HEXAGON_Vect1024
__attribute__((__vector_size__(128)))
33 __attribute__((aligned(128)));
35 // CHECK-LABEL: @test5
36 // CHECK: call <16 x i32> @llvm.hexagon.V6.vaddcarrysat(<16 x i32> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}}, <64 x i1> %{{[0-9]+}})
37 HEXAGON_Vect512
test5(void *in
, void *out
) {
38 HEXAGON_Vect512 v1
, v2
;
42 p
= (HEXAGON_Vect512
*)in
;
47 return __builtin_HEXAGON_V6_vaddcarrysat(v1
, v2
, __builtin_HEXAGON_V6_vandvrt(q1
, -1));
50 // CHECK-LABEL: @test6
51 // CHECK: call <16 x i32> @llvm.hexagon.V6.vrotr(<16 x i32> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}})
52 HEXAGON_Vect512
test6(void *in
, void *out
) {
53 HEXAGON_Vect512 v1
, v2
;
56 p
= (HEXAGON_Vect512
*)in
;
60 return __builtin_HEXAGON_V6_vrotr(v1
, v2
);
63 // CHECK-LABEL: @test7
64 // CHECK: call <16 x i32> @llvm.hexagon.V6.vsatdw(<16 x i32> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}})
65 HEXAGON_Vect512
test7(void *in
, void *out
) {
66 HEXAGON_Vect512 v1
, v2
;
69 p
= (HEXAGON_Vect512
*)in
;
73 return __builtin_HEXAGON_V6_vsatdw(v1
, v2
);
76 // CHECK-LABEL: @test8
77 // CHECK: call <32 x i32> @llvm.hexagon.V6.vasr.into(<32 x i32> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}})
78 HEXAGON_Vect1024
test8(void *in1
, void *in2
, void *out
) {
79 HEXAGON_Vect512 v1
, v2
;
84 p1
= (HEXAGON_Vect512
*)in1
;
87 p2
= (HEXAGON_Vect1024
*)in2
;
90 return __builtin_HEXAGON_V6_vasr_into(vr
, v1
, v2
);
93 // CHECK-LABEL: @test9
94 // CHECK: call { <16 x i32>, <64 x i1> } @llvm.hexagon.V6.vaddcarryo(<16 x i32> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}})
95 HEXAGON_Vect512
test9(void *in
, void *out
) {
96 HEXAGON_Vect512 v1
, v2
;
100 p
= (HEXAGON_Vect512
*)in
;
105 return __builtin_HEXAGON_V6_vaddcarryo(v1
, v2
, &q1
);
108 // CHECK-LABEL: @test10
109 // CHECK: call { <16 x i32>, <64 x i1> } @llvm.hexagon.V6.vsubcarryo(<16 x i32> %{{[0-9]+}}, <16 x i32> %{{[0-9]+}})
110 HEXAGON_Vect512
test10(void *in
, void *out
) {
111 HEXAGON_Vect512 v1
, v2
;
113 HEXAGON_VecPred64 q1
;
115 p
= (HEXAGON_Vect512
*)in
;
120 return __builtin_HEXAGON_V6_vsubcarryo(v1
, v2
, &q1
);