1 ; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s %s -o - | FileCheck %s --check-prefix=CHECK-DSP
2 ; RUN: llc -mtriple=thumb-eabi -mcpu=cortex-m3 %s -o - | FileCheck %s --check-prefix=CHECK-NO-DSP
3 ; RUN: llc -mtriple=thumbv7em-eabi %s -o - | FileCheck %s -check-prefix=CHECK-DSP
4 ; RUN: llc -mtriple=thumbv8m.main-none-eabi %s -o - | FileCheck %s -check-prefix=CHECK-NO-DSP
5 ; RUN: llc -mtriple=thumbv8m.main-none-eabi -mattr=+dsp %s -o - | FileCheck %s -check-prefix=CHECK-DSP
7 define i32 @test0(i8 %A) {
9 ; CHECK-DSP: sxtb r0, r0
10 ; CHECK-NO-DSP: sxtb r0, r0
11 %B = sext i8 %A to i32
15 define signext i8 @test1(i32 %A) {
17 ; CHECK-DSP: sbfx r0, r0, #8, #8
18 ; CHECK-NO-DSP: sbfx r0, r0, #8, #8
22 %E = trunc i32 %D to i8
26 define signext i32 @test2(i32 %A, i32 %X) {
28 ; CHECK-DSP: sxtab r0, r1, r0, ror #8
29 ; CHECK-NO-DSP-NOT: sxtab
33 %E = trunc i32 %D to i8
34 %F = sext i8 %E to i32
39 define i32 @test3(i32 %A, i32 %X) {
41 ; CHECK-DSP: sxtah r0, r0, r1, ror #8
42 ; CHECK-NO-DSP-NOT: sxtah
43 %X.hi = lshr i32 %X, 8
44 %X.trunc = trunc i32 %X.hi to i16
45 %addend = sext i16 %X.trunc to i32
46 %sum = add i32 %A, %addend
50 define signext i32 @test4(i32 %A, i32 %X) {
52 ; CHECK-DSP: sxtab r0, r1, r0, ror #16
53 ; CHECK-NO-DSP-NOT: sxtab
57 %E = trunc i32 %D to i8
58 %F = sext i8 %E to i32
63 define signext i32 @test5(i32 %A, i32 %X) {
65 ; CHECK-DSP: sxtah r0, r1, r0, ror #24
66 ; CHECK-NO-DSP-NOT: sxtah
70 %E = trunc i32 %D to i16
71 %F = sext i16 %E to i32