1 ; RUN: llc < %s -march=thumb -mattr=+thumb2,+t2xtpk | FileCheck %s 2 3 define i32 @t2ADDrs_lsl(i32 %X, i32 %Y) { 4 ; CHECK: t2ADDrs_lsl 5 ; CHECK: add.w r0, r0, r1, lsl #16 6 %A = shl i32 %Y, 16 7 %B = add i32 %X, %A 8 ret i32 %B 9 } 10 11 define i32 @t2ADDrs_lsr(i32 %X, i32 %Y) { 12 ; CHECK: t2ADDrs_lsr 13 ; CHECK: add.w r0, r0, r1, lsr #16 14 %A = lshr i32 %Y, 16 15 %B = add i32 %X, %A 16 ret i32 %B 17 } 18 19 define i32 @t2ADDrs_asr(i32 %X, i32 %Y) { 20 ; CHECK: t2ADDrs_asr 21 ; CHECK: add.w r0, r0, r1, asr #16 22 %A = ashr i32 %Y, 16 23 %B = add i32 %X, %A 24 ret i32 %B 25 } 26 27 ; i32 ror(n) = (x >> n) | (x << (32 - n)) 28 define i32 @t2ADDrs_ror(i32 %X, i32 %Y) { 29 ; CHECK: t2ADDrs_ror 30 ; CHECK: add.w r0, r0, r1, ror #16 31 %A = lshr i32 %Y, 16 32 %B = shl i32 %Y, 16 33 %C = or i32 %B, %A 34 %R = add i32 %X, %C 35 ret i32 %R 36 } 37 38 define i32 @t2ADDrs_noRegShift(i32 %X, i32 %Y, i8 %sh) { 39 ; CHECK: t2ADDrs_noRegShift 40 ; CHECK: uxtb r2, r2 41 ; CHECK: lsls r1, r2 42 ; CHECK: add r0, r1 43 %shift.upgrd.1 = zext i8 %sh to i32 44 %A = shl i32 %Y, %shift.upgrd.1 45 %B = add i32 %X, %A 46 ret i32 %B 47 } 48 49