Skip to content

Commit 63541c2

Browse files
Add new tests for i16 to i64 and i28
1 parent 899ef15 commit 63541c2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

llvm/test/CodeGen/AArch64/bswap.ll

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
; RUN: llc -mtriple=aarch64 -global-isel %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GI
44

55
; ====== Scalar Tests =====
6-
define i16 @bswap_i16_to_i16(i16 %a){
6+
7+
; ====== Scalar bswap.i16 Tests =====
8+
define i16 @bswap_i16_to_i16_anyext(i16 %a){
79
; CHECK-SD-LABEL: bswap_i16_to_i16:
810
; CHECK-SD: // %bb.0:
911
; CHECK-SD-NEXT: rev16 w0, w0
@@ -19,7 +21,23 @@ define i16 @bswap_i16_to_i16(i16 %a){
1921
}
2022
declare i16 @llvm.bswap.i16(i16)
2123

22-
define i32 @bswap_i16_to_i32(i16 %a){
24+
; The zext here is optimised to an any_extend during isel.
25+
define i64 @bswap_i16_to_i64_anyext(i16 %a) {
26+
%3 = call i16 @llvm.bswap.i16(i16 %a)
27+
%4 = zext i16 %3 to i64
28+
%5 = shl i64 %5, 48
29+
ret i64 %5
30+
}
31+
32+
; The zext here is optimised to an any_extend during isel..
33+
define i128 @bswap_i16_to_i128_anyext(i16 %a) {
34+
%3 = call i16 @llvm.bswap.i16(i16 %a)
35+
%4 = zext i16 %3 to i128
36+
%5 = shl i128 %4, 112
37+
ret i128 %d
38+
}
39+
40+
define i32 @bswap_i16_to_i32_zext(i16 %a){
2341
; CHECK-LABEL: bswap_i16_to_i32:
2442
; CHECK: // %bb.0:
2543
; CHECK-NEXT: rev w8, w0
@@ -30,6 +48,7 @@ define i32 @bswap_i16_to_i32(i16 %a){
3048
ret i32 %4
3149
}
3250

51+
; ====== Other scalar bswap tests =====
3352
define i32 @bswap_i32(i32 %a){
3453
; CHECK-LABEL: bswap_i32:
3554
; CHECK: // %bb.0:

0 commit comments

Comments
 (0)