1; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s 2 3declare i128 @llvm.bswap.i128(i128) 4declare i64 @llvm.bswap.i64(i64) 5declare i32 @llvm.bswap.i32(i32) 6declare i16 @llvm.bswap.i16(i16) 7 8define i128 @func128(i128 %p) { 9; CHECK-LABEL: func128: 10; CHECK: # %bb.0: 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) 16 ret i128 %r 17} 18 19define i64 @func64(i64 %p) { 20; CHECK-LABEL: func64: 21; CHECK: # %bb.0: 22; CHECK-NEXT: bswp %s0, %s0, 0 23; CHECK-NEXT: b.l.t (, %s10) 24 %r = tail call i64 @llvm.bswap.i64(i64 %p) 25 ret i64 %r 26} 27 28define signext i32 @func32s(i32 signext %p) { 29; CHECK-LABEL: func32s: 30; CHECK: # %bb.0: 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) 35 ret i32 %r 36} 37 38define zeroext i32 @func32z(i32 zeroext %p) { 39; CHECK-LABEL: func32z: 40; CHECK: # %bb.0: 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) 45 ret i32 %r 46} 47 48define signext i16 @func16s(i16 signext %p) { 49; CHECK-LABEL: func16s: 50; CHECK: # %bb.0: 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) 58 ret i16 %r 59} 60 61define zeroext i16 @func16z(i16 zeroext %p) { 62; CHECK-LABEL: func16z: 63; CHECK: # %bb.0: 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) 70 ret i16 %r 71} 72 73define i128 @func128i() { 74; CHECK-LABEL: func128i: 75; CHECK: # %bb.0: 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) 80 ret i128 %r 81} 82 83define i64 @func64i() { 84; CHECK-LABEL: func64i: 85; CHECK: # %bb.0: 86; CHECK-NEXT: lea.sl %s0, -16777216 87; CHECK-NEXT: b.l.t (, %s10) 88 %r = tail call i64 @llvm.bswap.i64(i64 255) 89 ret i64 %r 90} 91 92define signext i32 @func32si() { 93; CHECK-LABEL: func32si: 94; CHECK: # %bb.0: 95; CHECK-NEXT: lea %s0, -16777216 96; CHECK-NEXT: b.l.t (, %s10) 97 %r = tail call i32 @llvm.bswap.i32(i32 255) 98 ret i32 %r 99} 100 101define zeroext i32 @func32zi() { 102; CHECK-LABEL: func32zi: 103; CHECK: # %bb.0: 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) 108 ret i32 %r 109} 110 111define signext i16 @func16si() { 112; CHECK-LABEL: func16si: 113; CHECK: # %bb.0: 114; CHECK-NEXT: lea %s0, -256 115; CHECK-NEXT: b.l.t (, %s10) 116 %r = tail call i16 @llvm.bswap.i16(i16 255) 117 ret i16 %r 118} 119 120define zeroext i16 @func16zi() { 121; CHECK-LABEL: func16zi: 122; CHECK: # %bb.0: 123; CHECK-NEXT: lea %s0, 65280 124; CHECK-NEXT: b.l.t (, %s10) 125 %r = tail call i16 @llvm.bswap.i16(i16 255) 126 ret i16 %r 127} 128