1 ; RUN: llc -mtriple=thumb-eabi -mcpu=cortex-a8 %s -o - | FileCheck %s --check-prefix=A8 2 ; RUN: llc -mtriple=thumb-eabi -mcpu=cortex-m3 %s -o - | FileCheck %s --check-prefix=M3 3 ; rdar://11318438 4 5 define zeroext i8 @test1(i32 %A.u) { 6 ; A8-LABEL: test1: 7 ; A8: uxtb r0, r0 8 %B.u = trunc i32 %A.u to i8 9 ret i8 %B.u 10 } 11 12 define zeroext i32 @test2(i32 %A.u, i32 %B.u) { 13 ; A8-LABEL: test2: 14 ; A8: uxtab r0, r0, r1 15 16 ; M3-LABEL: test2: 17 ; M3: uxtb r1, r1 18 ; M3-NOT: uxtab 19 ; M3: add r0, r1 20 %C.u = trunc i32 %B.u to i8 21 %D.u = zext i8 %C.u to i32 22 %E.u = add i32 %A.u, %D.u 23 ret i32 %E.u 24 } 25 26 define zeroext i32 @test3(i32 %A.u) { 27 ; A8-LABEL: test3: 28 ; A8: ubfx r0, r0, #8, #16 29 %B.u = lshr i32 %A.u, 8 30 %C.u = shl i32 %A.u, 24 31 %D.u = or i32 %B.u, %C.u 32 %E.u = trunc i32 %D.u to i16 33 %F.u = zext i16 %E.u to i32 34 ret i32 %F.u 35 } 36 37 define i32 @test4(i32 %A, i32 %X) { 38 ; A8-LABEL: test4: 39 ; A8: uxtab r0, r0, r1, ror #16 40 %X.hi = lshr i32 %X, 16 41 %X.trunc = trunc i32 %X.hi to i8 42 %addend = zext i8 %X.trunc to i32 43 44 %sum = add i32 %A, %addend 45 ret i32 %sum 46 } 47 48 define i32 @test5(i32 %A, i32 %X) { 49 ; A8-LABEL: test5: 50 ; A8: uxtah r0, r0, r1, ror #8 51 %X.hi = lshr i32 %X, 8 52 %X.trunc = trunc i32 %X.hi to i16 53 %addend = zext i16 %X.trunc to i32 54 55 %sum = add i32 %A, %addend 56 ret i32 %sum 57 } 58