1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=arm-eabi -mattr=+v6 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-V6
3 ; RUN: llc -mtriple=arm-eabi -mattr=+v7 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-V7
5 define i32 @test0(i8 %A) {
8 ; CHECK-NEXT: sxtb r0, r0
10 %B = sext i8 %A to i32
14 define signext i8 @test1(i32 %A) {
15 ; CHECK-V6-LABEL: test1:
17 ; CHECK-V6-NEXT: lsr r0, r0, #8
18 ; CHECK-V6-NEXT: sxtb r0, r0
19 ; CHECK-V6-NEXT: bx lr
21 ; CHECK-V7-LABEL: test1:
23 ; CHECK-V7-NEXT: sbfx r0, r0, #8, #8
24 ; CHECK-V7-NEXT: bx lr
25 ; CHECk-V7: sbfx r0, r0, #8, #8
29 %E = trunc i32 %D to i8
33 define signext i32 @test2(i32 %A, i32 %X) {
36 ; CHECK-NEXT: sxtab r0, r1, r0, ror #8
41 %E = trunc i32 %D to i8
42 %F = sext i8 %E to i32
47 define signext i32 @test3(i32 %A, i32 %X) {
50 ; CHECK-NEXT: sxtab r0, r1, r0, ror #16
55 %E = trunc i32 %D to i8
56 %F = sext i8 %E to i32
61 define signext i32 @test4(i32 %A, i32 %X) {
64 ; CHECK-NEXT: sxtah r0, r1, r0, ror #8
69 %E = trunc i32 %D to i16
70 %F = sext i16 %E to i32
75 define signext i32 @test5(i32 %A, i32 %X) {
78 ; CHECK-NEXT: sxtah r0, r1, r0, ror #24
83 %E = trunc i32 %D to i16
84 %F = sext i16 %E to i32
89 define i32 @test6(i8 %A, i32 %X) {
92 ; CHECK-NEXT: sxtab r0, r1, r0
94 %sext = sext i8 %A to i32
95 %add = add i32 %X, %sext
99 define i32 @test7(i32 %A, i32 %X) {
100 ; CHECK-LABEL: test7:
102 ; CHECK-NEXT: sxtab r0, r1, r0
104 %shl = shl i32 %A, 24
105 %shr = ashr i32 %shl, 24
106 %add = add i32 %X, %shr
110 define i32 @test8(i16 %A, i32 %X) {
111 ; CHECK-LABEL: test8:
113 ; CHECK-NEXT: sxtah r0, r1, r0
115 %sext = sext i16 %A to i32
116 %add = add i32 %X, %sext
120 define i32 @test9(i32 %A, i32 %X) {
121 ; CHECK-LABEL: test9:
123 ; CHECK-NEXT: sxtah r0, r1, r0
125 %shl = shl i32 %A, 16
126 %shr = ashr i32 %shl, 16
127 %add = add i32 %X, %shr