2010-05-06 01:44:43 +02:00
|
|
|
; RUN: llc < %s -march=thumb -mattr=+thumb2,+t2xtpk | FileCheck %s
|
2009-06-17 20:13:58 +02:00
|
|
|
|
|
|
|
define i32 @t2ADDrs_lsl(i32 %X, i32 %Y) {
|
2009-11-17 00:19:29 +01:00
|
|
|
; CHECK: t2ADDrs_lsl
|
|
|
|
; CHECK: add.w r0, r0, r1, lsl #16
|
2009-06-17 20:13:58 +02:00
|
|
|
%A = shl i32 %Y, 16
|
|
|
|
%B = add i32 %X, %A
|
|
|
|
ret i32 %B
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @t2ADDrs_lsr(i32 %X, i32 %Y) {
|
2009-11-17 00:19:29 +01:00
|
|
|
; CHECK: t2ADDrs_lsr
|
|
|
|
; CHECK: add.w r0, r0, r1, lsr #16
|
2009-06-17 20:13:58 +02:00
|
|
|
%A = lshr i32 %Y, 16
|
|
|
|
%B = add i32 %X, %A
|
|
|
|
ret i32 %B
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @t2ADDrs_asr(i32 %X, i32 %Y) {
|
2009-11-17 00:19:29 +01:00
|
|
|
; CHECK: t2ADDrs_asr
|
|
|
|
; CHECK: add.w r0, r0, r1, asr #16
|
2009-06-17 20:13:58 +02:00
|
|
|
%A = ashr i32 %Y, 16
|
|
|
|
%B = add i32 %X, %A
|
|
|
|
ret i32 %B
|
|
|
|
}
|
|
|
|
|
|
|
|
; i32 ror(n) = (x >> n) | (x << (32 - n))
|
|
|
|
define i32 @t2ADDrs_ror(i32 %X, i32 %Y) {
|
2009-11-17 00:19:29 +01:00
|
|
|
; CHECK: t2ADDrs_ror
|
|
|
|
; CHECK: add.w r0, r0, r1, ror #16
|
2009-06-17 20:13:58 +02:00
|
|
|
%A = lshr i32 %Y, 16
|
|
|
|
%B = shl i32 %Y, 16
|
|
|
|
%C = or i32 %B, %A
|
|
|
|
%R = add i32 %X, %C
|
|
|
|
ret i32 %R
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32 @t2ADDrs_noRegShift(i32 %X, i32 %Y, i8 %sh) {
|
2009-11-17 00:19:29 +01:00
|
|
|
; CHECK: t2ADDrs_noRegShift
|
|
|
|
; CHECK: uxtb r2, r2
|
|
|
|
; CHECK: lsls r1, r2
|
|
|
|
; CHECK: add r0, r1
|
2009-06-17 20:13:58 +02:00
|
|
|
%shift.upgrd.1 = zext i8 %sh to i32
|
|
|
|
%A = shl i32 %Y, %shift.upgrd.1
|
|
|
|
%B = add i32 %X, %A
|
|
|
|
ret i32 %B
|
|
|
|
}
|
|
|
|
|