3
3
; RUN: llc -mtriple=aarch64 -global-isel %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GI
4
4
5
5
; ====== 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 ){
7
9
; CHECK-SD-LABEL: bswap_i16_to_i16:
8
10
; CHECK-SD: // %bb.0:
9
11
; CHECK-SD-NEXT: rev16 w0, w0
@@ -19,7 +21,23 @@ define i16 @bswap_i16_to_i16(i16 %a){
19
21
}
20
22
declare i16 @llvm.bswap.i16 (i16 )
21
23
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 ){
23
41
; CHECK-LABEL: bswap_i16_to_i32:
24
42
; CHECK: // %bb.0:
25
43
; CHECK-NEXT: rev w8, w0
@@ -30,6 +48,7 @@ define i32 @bswap_i16_to_i32(i16 %a){
30
48
ret i32 %4
31
49
}
32
50
51
+ ; ====== Other scalar bswap tests =====
33
52
define i32 @bswap_i32 (i32 %a ){
34
53
; CHECK-LABEL: bswap_i32:
35
54
; CHECK: // %bb.0:
0 commit comments