1; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2,+t2xtpk %s -o - \ 2; RUN: | FileCheck %s 3 4define i32 @test0(i8 %A) { 5; CHECK-LABEL: test0: 6; CHECK: sxtb r0, r0 7 %B = sext i8 %A to i32 8 ret i32 %B 9} 10 11define signext i8 @test1(i32 %A) { 12; CHECK-LABEL: test1: 13; CHECK: sbfx r0, r0, #8, #8 14 %B = lshr i32 %A, 8 15 %C = shl i32 %A, 24 16 %D = or i32 %B, %C 17 %E = trunc i32 %D to i8 18 ret i8 %E 19} 20 21define signext i32 @test2(i32 %A, i32 %X) { 22; CHECK-LABEL: test2: 23; CHECK: sxtab r0, r1, r0, ror #8 24 %B = lshr i32 %A, 8 25 %C = shl i32 %A, 24 26 %D = or i32 %B, %C 27 %E = trunc i32 %D to i8 28 %F = sext i8 %E to i32 29 %G = add i32 %F, %X 30 ret i32 %G 31} 32 33define i32 @test3(i32 %A, i32 %X) { 34; CHECK-LABEL: test3: 35; CHECK: sxtah r0, r0, r1, ror #8 36 %X.hi = lshr i32 %X, 8 37 %X.trunc = trunc i32 %X.hi to i16 38 %addend = sext i16 %X.trunc to i32 39 40 %sum = add i32 %A, %addend 41 ret i32 %sum 42} 43