1 ; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
3 declare i128 @llvm.bitreverse.i128(i128)
4 declare i64 @llvm.bitreverse.i64(i64)
5 declare i32 @llvm.bitreverse.i32(i32)
6 declare i16 @llvm.bitreverse.i16(i16)
7 declare i8 @llvm.bitreverse.i8(i8)
9 define i128 @func128(i128 %p) {
10 ; CHECK-LABEL: func128:
12 ; CHECK-NEXT: brv %s2, %s1
13 ; CHECK-NEXT: brv %s1, %s0
14 ; CHECK-NEXT: or %s0, 0, %s2
15 ; CHECK-NEXT: b.l.t (, %s10)
16 %r = tail call i128 @llvm.bitreverse.i128(i128 %p)
20 define i64 @func64(i64 %p) {
21 ; CHECK-LABEL: func64:
23 ; CHECK-NEXT: brv %s0, %s0
24 ; CHECK-NEXT: b.l.t (, %s10)
25 %r = tail call i64 @llvm.bitreverse.i64(i64 %p)
29 define signext i32 @func32s(i32 signext %p) {
30 ; CHECK-LABEL: func32s:
32 ; CHECK-NEXT: brv %s0, %s0
33 ; CHECK-NEXT: sra.l %s0, %s0, 32
34 ; CHECK-NEXT: b.l.t (, %s10)
35 %r = tail call i32 @llvm.bitreverse.i32(i32 %p)
39 define zeroext i32 @func32z(i32 zeroext %p) {
40 ; CHECK-LABEL: func32z:
42 ; CHECK-NEXT: brv %s0, %s0
43 ; CHECK-NEXT: srl %s0, %s0, 32
44 ; CHECK-NEXT: b.l.t (, %s10)
45 %r = tail call i32 @llvm.bitreverse.i32(i32 %p)
49 define signext i16 @func16s(i16 signext %p) {
50 ; CHECK-LABEL: func16s:
52 ; CHECK-NEXT: brv %s0, %s0
53 ; CHECK-NEXT: sra.l %s0, %s0, 48
54 ; CHECK-NEXT: b.l.t (, %s10)
55 %r = tail call i16 @llvm.bitreverse.i16(i16 %p)
59 define zeroext i16 @func16z(i16 zeroext %p) {
60 ; CHECK-LABEL: func16z:
62 ; CHECK-NEXT: brv %s0, %s0
63 ; CHECK-NEXT: srl %s0, %s0, 48
64 ; CHECK-NEXT: b.l.t (, %s10)
65 %r = tail call i16 @llvm.bitreverse.i16(i16 %p)
69 define signext i8 @func8s(i8 signext %p) {
70 ; CHECK-LABEL: func8s:
72 ; CHECK-NEXT: brv %s0, %s0
73 ; CHECK-NEXT: sra.l %s0, %s0, 56
74 ; CHECK-NEXT: b.l.t (, %s10)
75 %r = tail call i8 @llvm.bitreverse.i8(i8 %p)
79 define zeroext i8 @func8z(i8 zeroext %p) {
80 ; CHECK-LABEL: func8z:
82 ; CHECK-NEXT: brv %s0, %s0
83 ; CHECK-NEXT: srl %s0, %s0, 56
84 ; CHECK-NEXT: b.l.t (, %s10)
85 %r = tail call i8 @llvm.bitreverse.i8(i8 %p)
89 define i128 @func128i() {
90 ; CHECK-LABEL: func128i:
92 ; CHECK-NEXT: or %s0, 0, (0)1
93 ; CHECK-NEXT: lea.sl %s1, -65536
94 ; CHECK-NEXT: b.l.t (, %s10)
95 %r = tail call i128 @llvm.bitreverse.i128(i128 65535)
99 define i64 @func64i() {
100 ; CHECK-LABEL: func64i:
102 ; CHECK-NEXT: lea.sl %s0, -65536
103 ; CHECK-NEXT: b.l.t (, %s10)
104 %r = tail call i64 @llvm.bitreverse.i64(i64 65535)
108 define signext i32 @func32is() {
109 ; CHECK-LABEL: func32is:
111 ; CHECK-NEXT: lea %s0, -65536
112 ; CHECK-NEXT: b.l.t (, %s10)
113 %r = tail call i32 @llvm.bitreverse.i32(i32 65535)
117 define zeroext i32 @func32iz() {
118 ; CHECK-LABEL: func32iz:
120 ; CHECK-NEXT: lea %s0, -65536
121 ; CHECK-NEXT: and %s0, %s0, (32)0
122 ; CHECK-NEXT: b.l.t (, %s10)
123 %r = tail call i32 @llvm.bitreverse.i32(i32 65535)
127 define signext i16 @func16is() {
128 ; CHECK-LABEL: func16is:
130 ; CHECK-NEXT: lea %s0, -256
131 ; CHECK-NEXT: b.l.t (, %s10)
132 %r = tail call i16 @llvm.bitreverse.i16(i16 255)
136 define zeroext i16 @func16iz() {
137 ; CHECK-LABEL: func16iz:
139 ; CHECK-NEXT: lea %s0, 65280
140 ; CHECK-NEXT: b.l.t (, %s10)
141 %r = tail call i16 @llvm.bitreverse.i16(i16 255)
145 define signext i8 @func8is() {
146 ; CHECK-LABEL: func8is:
148 ; CHECK-NEXT: or %s0, 15, (0)1
149 ; CHECK-NEXT: b.l.t (, %s10)
150 %r = tail call i8 @llvm.bitreverse.i8(i8 240)
154 define zeroext i8 @func8iz() {
155 ; CHECK-LABEL: func8iz:
157 ; CHECK-NEXT: or %s0, 15, (0)1
158 ; CHECK-NEXT: b.l.t (, %s10)
159 %r = tail call i8 @llvm.bitreverse.i8(i8 240)