Skip to content

Commit 696a7bb

Browse files
committed
[VE] Support communication register intrinsics
Add regression tets for intrinsics using communication register.
1 parent e0c5640 commit 696a7bb

File tree

3 files changed

+166
-1
lines changed

3 files changed

+166
-1
lines changed

llvm/test/CodeGen/VE/VELIntrinsics/c/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ MERGER_TARGETS = vmrg.ll vshf.ll vcp.ll vex.ll
2222
MASK_TARGETS = vfmk.ll andm.ll orm.ll xorm.ll eqvm.ll nndm.ll negm.ll pcvm.ll \
2323
lzvm.ll tovm.ll
2424
REDUCTION_TARGETS = vsum.ll vfsum.ll vrmax.ll vrmin.ll vrand.ll vror.ll vrxor.ll
25+
CR_TARGETS = lcr.ll
2526
TRANSFER_TARGETS = svob.ll
2627
OTHERS_TARGETS = pack.ll extract.ll insert.ll
2728

2829
TARGETS = $(LDSTMV_TARGETS) $(ARITH_TARGETS) $(LOGICAL_TARGETS) \
2930
$(SHIFT_TARGETS) $(FP_ARITH_TARGETS) $(MERGER_TARGETS) $(MASK_TARGETS) \
30-
$(REDUCTION_TARGETS) $(TRANSFER_TARGETS) $(OTHERS_TARGETS)
31+
$(REDUCTION_TARGETS) $(CR_TARGETS) $(TRANSFER_TARGETS) $(OTHERS_TARGETS)
3132

3233
all: $(TARGETS)
3334

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "types.h"
2+
#include "velintrin.h"
3+
4+
/// Test intrinsics for communication register
5+
///
6+
/// Note:
7+
/// We test LCR, SCR, TSCR, and FIDCR instructions.
8+
9+
u64 lcr_sss(u64 sy, u64 sz) {
10+
return _vel_lcr_sss(sy, sz);
11+
}
12+
13+
void scr_sss(u64 sx, u64 sy, u64 sz) {
14+
_vel_scr_sss(sx, sy, sz);
15+
}
16+
17+
u64 tscr_ssss(u64 sx, u64 sy, u64 sz) {
18+
return _vel_tscr_ssss(sx, sy, sz);
19+
}
20+
21+
#define VL_FIDCR(N) \
22+
u64 fidcr_ss ## N(u64 sy) { \
23+
return _vel_fidcr_sss(sy, N); \
24+
}
25+
26+
VL_FIDCR(0)
27+
VL_FIDCR(1)
28+
VL_FIDCR(2)
29+
VL_FIDCR(3)
30+
VL_FIDCR(4)
31+
VL_FIDCR(5)
32+
VL_FIDCR(6)
33+
VL_FIDCR(7)
34+
// VL_FIDCR(8)
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
; RUN: llc < %s -mtriple=ve -mattr=+vpu,+packed | FileCheck %s
2+
3+
;;; Test intrinsics for communication register
4+
;;;
5+
;;; Note:
6+
;;; We test LCR, SCR, TSCR, and FIDCR instructions.
7+
8+
; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn
9+
define i64 @lcr_sss(i64 noundef %0, i64 noundef %1) {
10+
; CHECK-LABEL: lcr_sss:
11+
; CHECK: # %bb.0:
12+
; CHECK-NEXT: lcr %s0, %s0, %s1
13+
; CHECK-NEXT: b.l.t (, %s10)
14+
%3 = tail call i64 @llvm.ve.vl.lcr.sss(i64 %0, i64 %1)
15+
ret i64 %3
16+
}
17+
18+
; Function Attrs: nofree nosync nounwind readnone
19+
declare i64 @llvm.ve.vl.lcr.sss(i64, i64)
20+
21+
; Function Attrs: nounwind
22+
define void @scr_sss(i64 noundef %0, i64 noundef %1, i64 noundef %2) {
23+
; CHECK-LABEL: scr_sss:
24+
; CHECK: # %bb.0:
25+
; CHECK-NEXT: scr %s0, %s1, %s2
26+
; CHECK-NEXT: b.l.t (, %s10)
27+
tail call void @llvm.ve.vl.scr.sss(i64 %0, i64 %1, i64 %2)
28+
ret void
29+
}
30+
31+
; Function Attrs: nounwind
32+
declare void @llvm.ve.vl.scr.sss(i64, i64, i64)
33+
34+
; Function Attrs: nounwind
35+
define i64 @tscr_ssss(i64 noundef %0, i64 noundef %1, i64 noundef %2) {
36+
; CHECK-LABEL: tscr_ssss:
37+
; CHECK: # %bb.0:
38+
; CHECK-NEXT: tscr %s0, %s1, %s2
39+
; CHECK-NEXT: b.l.t (, %s10)
40+
%4 = tail call i64 @llvm.ve.vl.tscr.ssss(i64 %0, i64 %1, i64 %2)
41+
ret i64 %4
42+
}
43+
44+
; Function Attrs: nounwind
45+
declare i64 @llvm.ve.vl.tscr.ssss(i64, i64, i64)
46+
47+
; Function Attrs: nounwind
48+
define i64 @fidcr_ss0(i64 noundef %0) {
49+
; CHECK-LABEL: fidcr_ss0:
50+
; CHECK: # %bb.0:
51+
; CHECK-NEXT: fidcr %s0, %s0, 0
52+
; CHECK-NEXT: b.l.t (, %s10)
53+
%2 = tail call i64 @llvm.ve.vl.fidcr.sss(i64 %0, i32 0)
54+
ret i64 %2
55+
}
56+
57+
; Function Attrs: nounwind
58+
declare i64 @llvm.ve.vl.fidcr.sss(i64, i32)
59+
60+
; Function Attrs: nounwind
61+
define i64 @fidcr_ss1(i64 noundef %0) {
62+
; CHECK-LABEL: fidcr_ss1:
63+
; CHECK: # %bb.0:
64+
; CHECK-NEXT: fidcr %s0, %s0, 1
65+
; CHECK-NEXT: b.l.t (, %s10)
66+
%2 = tail call i64 @llvm.ve.vl.fidcr.sss(i64 %0, i32 1)
67+
ret i64 %2
68+
}
69+
70+
; Function Attrs: nounwind
71+
define i64 @fidcr_ss2(i64 noundef %0) {
72+
; CHECK-LABEL: fidcr_ss2:
73+
; CHECK: # %bb.0:
74+
; CHECK-NEXT: fidcr %s0, %s0, 2
75+
; CHECK-NEXT: b.l.t (, %s10)
76+
%2 = tail call i64 @llvm.ve.vl.fidcr.sss(i64 %0, i32 2)
77+
ret i64 %2
78+
}
79+
80+
; Function Attrs: nounwind
81+
define i64 @fidcr_ss3(i64 noundef %0) {
82+
; CHECK-LABEL: fidcr_ss3:
83+
; CHECK: # %bb.0:
84+
; CHECK-NEXT: fidcr %s0, %s0, 3
85+
; CHECK-NEXT: b.l.t (, %s10)
86+
%2 = tail call i64 @llvm.ve.vl.fidcr.sss(i64 %0, i32 3)
87+
ret i64 %2
88+
}
89+
90+
; Function Attrs: nounwind
91+
define i64 @fidcr_ss4(i64 noundef %0) {
92+
; CHECK-LABEL: fidcr_ss4:
93+
; CHECK: # %bb.0:
94+
; CHECK-NEXT: fidcr %s0, %s0, 4
95+
; CHECK-NEXT: b.l.t (, %s10)
96+
%2 = tail call i64 @llvm.ve.vl.fidcr.sss(i64 %0, i32 4)
97+
ret i64 %2
98+
}
99+
100+
; Function Attrs: nounwind
101+
define i64 @fidcr_ss5(i64 noundef %0) {
102+
; CHECK-LABEL: fidcr_ss5:
103+
; CHECK: # %bb.0:
104+
; CHECK-NEXT: fidcr %s0, %s0, 5
105+
; CHECK-NEXT: b.l.t (, %s10)
106+
%2 = tail call i64 @llvm.ve.vl.fidcr.sss(i64 %0, i32 5)
107+
ret i64 %2
108+
}
109+
110+
; Function Attrs: nounwind
111+
define i64 @fidcr_ss6(i64 noundef %0) {
112+
; CHECK-LABEL: fidcr_ss6:
113+
; CHECK: # %bb.0:
114+
; CHECK-NEXT: fidcr %s0, %s0, 6
115+
; CHECK-NEXT: b.l.t (, %s10)
116+
%2 = tail call i64 @llvm.ve.vl.fidcr.sss(i64 %0, i32 6)
117+
ret i64 %2
118+
}
119+
120+
; Function Attrs: nounwind
121+
define i64 @fidcr_ss7(i64 noundef %0) {
122+
; CHECK-LABEL: fidcr_ss7:
123+
; CHECK: # %bb.0:
124+
; CHECK-NEXT: fidcr %s0, %s0, 7
125+
; CHECK-NEXT: b.l.t (, %s10)
126+
%2 = tail call i64 @llvm.ve.vl.fidcr.sss(i64 %0, i32 7)
127+
ret i64 %2
128+
}
129+
130+
!2 = !{!"clang version 15.0.0 (git@kaz7.github.com:sx-aurora-dev/llvm-project.git e0c5640dba6e9ba1cd29ed8d59b85c6378e48ac7)"}

0 commit comments

Comments
 (0)