1 ; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s
3 declare i128 @llvm.bswap.i128(i128)
4 declare i64 @llvm.bswap.i64(i64)
5 declare i32 @llvm.bswap.i32(i32)
6 declare i16 @llvm.bswap.i16(i16)
8 define i128 @func128(i128 %p) {
9 ; CHECK-LABEL: func128:
11 ; CHECK-NEXT: bswp %s2, %s1, 0
12 ; CHECK-NEXT: bswp %s1, %s0, 0
13 ; CHECK-NEXT: or %s0, 0, %s2
14 ; CHECK-NEXT: b.l.t (, %s10)
15 %r = tail call i128 @llvm.bswap.i128(i128 %p)
19 define i64 @func64(i64 %p) {
20 ; CHECK-LABEL: func64:
22 ; CHECK-NEXT: bswp %s0, %s0, 0
23 ; CHECK-NEXT: b.l.t (, %s10)
24 %r = tail call i64 @llvm.bswap.i64(i64 %p)
28 define signext i32 @func32s(i32 signext %p) {
29 ; CHECK-LABEL: func32s:
31 ; CHECK-NEXT: bswp %s0, %s0, 1
32 ; CHECK-NEXT: adds.w.sx %s0, %s0, (0)1
33 ; CHECK-NEXT: b.l.t (, %s10)
34 %r = tail call i32 @llvm.bswap.i32(i32 %p)
38 define zeroext i32 @func32z(i32 zeroext %p) {
39 ; CHECK-LABEL: func32z:
41 ; CHECK-NEXT: bswp %s0, %s0, 1
42 ; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1
43 ; CHECK-NEXT: b.l.t (, %s10)
44 %r = tail call i32 @llvm.bswap.i32(i32 %p)
48 define signext i16 @func16s(i16 signext %p) {
49 ; CHECK-LABEL: func16s:
51 ; CHECK-NEXT: bswp %s0, %s0, 1
52 ; CHECK-NEXT: and %s0, %s0, (32)0
53 ; CHECK-NEXT: srl %s0, %s0, 16
54 ; CHECK-NEXT: sll %s0, %s0, 48
55 ; CHECK-NEXT: sra.l %s0, %s0, 48
56 ; CHECK-NEXT: b.l.t (, %s10)
57 %r = tail call i16 @llvm.bswap.i16(i16 %p)
61 define zeroext i16 @func16z(i16 zeroext %p) {
62 ; CHECK-LABEL: func16z:
64 ; CHECK-NEXT: bswp %s0, %s0, 1
65 ; CHECK-NEXT: and %s0, %s0, (32)0
66 ; CHECK-NEXT: srl %s0, %s0, 16
67 ; CHECK-NEXT: adds.w.zx %s0, %s0, (0)1
68 ; CHECK-NEXT: b.l.t (, %s10)
69 %r = tail call i16 @llvm.bswap.i16(i16 %p)
73 define i128 @func128i() {
74 ; CHECK-LABEL: func128i:
76 ; CHECK-NEXT: or %s0, 0, (0)1
77 ; CHECK-NEXT: lea.sl %s1, -16777216
78 ; CHECK-NEXT: b.l.t (, %s10)
79 %r = tail call i128 @llvm.bswap.i128(i128 255)
83 define i64 @func64i() {
84 ; CHECK-LABEL: func64i:
86 ; CHECK-NEXT: lea.sl %s0, -16777216
87 ; CHECK-NEXT: b.l.t (, %s10)
88 %r = tail call i64 @llvm.bswap.i64(i64 255)
92 define signext i32 @func32si() {
93 ; CHECK-LABEL: func32si:
95 ; CHECK-NEXT: lea %s0, -16777216
96 ; CHECK-NEXT: b.l.t (, %s10)
97 %r = tail call i32 @llvm.bswap.i32(i32 255)
101 define zeroext i32 @func32zi() {
102 ; CHECK-LABEL: func32zi:
104 ; CHECK-NEXT: lea %s0, -16777216
105 ; CHECK-NEXT: and %s0, %s0, (32)0
106 ; CHECK-NEXT: b.l.t (, %s10)
107 %r = tail call i32 @llvm.bswap.i32(i32 255)
111 define signext i16 @func16si() {
112 ; CHECK-LABEL: func16si:
114 ; CHECK-NEXT: lea %s0, -256
115 ; CHECK-NEXT: b.l.t (, %s10)
116 %r = tail call i16 @llvm.bswap.i16(i16 255)
120 define zeroext i16 @func16zi() {
121 ; CHECK-LABEL: func16zi:
123 ; CHECK-NEXT: lea %s0, 65280
124 ; CHECK-NEXT: b.l.t (, %s10)
125 %r = tail call i16 @llvm.bswap.i16(i16 255)