2010-08-16 19:05:27 +02:00
|
|
|
; RUN: llc < %s -march=arm -mattr=+v6 | FileCheck %s
|
2007-04-15 21:11:47 +02:00
|
|
|
|
2010-08-16 19:05:27 +02:00
|
|
|
; CHECK: test1
|
|
|
|
; CHECK: pkhbt r0, r0, r1, lsl #16
|
2008-02-17 21:02:20 +01:00
|
|
|
define i32 @test1(i32 %X, i32 %Y) {
|
2010-10-23 00:01:56 +02:00
|
|
|
%tmp1 = and i32 %X, 65535
|
|
|
|
%tmp4 = shl i32 %Y, 16
|
|
|
|
%tmp5 = or i32 %tmp4, %tmp1
|
2008-02-17 21:02:20 +01:00
|
|
|
ret i32 %tmp5
|
2007-01-19 10:20:23 +01:00
|
|
|
}
|
|
|
|
|
2010-08-16 19:05:27 +02:00
|
|
|
; CHECK: test2
|
|
|
|
; CHECK: pkhbt r0, r0, r1, lsl #12
|
2008-02-17 21:02:20 +01:00
|
|
|
define i32 @test2(i32 %X, i32 %Y) {
|
2010-10-23 00:01:56 +02:00
|
|
|
%tmp1 = and i32 %X, 65535
|
|
|
|
%tmp3 = shl i32 %Y, 12
|
|
|
|
%tmp4 = and i32 %tmp3, -65536
|
|
|
|
%tmp57 = or i32 %tmp4, %tmp1
|
2008-02-17 21:02:20 +01:00
|
|
|
ret i32 %tmp57
|
2007-01-19 10:20:23 +01:00
|
|
|
}
|
|
|
|
|
2010-08-16 19:05:27 +02:00
|
|
|
; CHECK: test3
|
|
|
|
; CHECK: pkhbt r0, r0, r1, lsl #18
|
2008-02-17 21:02:20 +01:00
|
|
|
define i32 @test3(i32 %X, i32 %Y) {
|
2010-10-23 00:01:56 +02:00
|
|
|
%tmp19 = and i32 %X, 65535
|
|
|
|
%tmp37 = shl i32 %Y, 18
|
|
|
|
%tmp5 = or i32 %tmp37, %tmp19
|
2008-02-17 21:02:20 +01:00
|
|
|
ret i32 %tmp5
|
2007-01-19 10:20:23 +01:00
|
|
|
}
|
|
|
|
|
2010-08-16 19:05:27 +02:00
|
|
|
; CHECK: test4
|
2010-08-17 19:23:19 +02:00
|
|
|
; CHECK: pkhbt r0, r0, r1
|
2008-02-17 21:02:20 +01:00
|
|
|
define i32 @test4(i32 %X, i32 %Y) {
|
2010-10-23 00:01:56 +02:00
|
|
|
%tmp1 = and i32 %X, 65535
|
|
|
|
%tmp3 = and i32 %Y, -65536
|
|
|
|
%tmp46 = or i32 %tmp3, %tmp1
|
2008-02-17 21:02:20 +01:00
|
|
|
ret i32 %tmp46
|
2007-01-19 10:20:23 +01:00
|
|
|
}
|
|
|
|
|
2010-08-16 19:05:27 +02:00
|
|
|
; CHECK: test5
|
|
|
|
; CHECK: pkhtb r0, r0, r1, asr #16
|
2008-02-17 21:02:20 +01:00
|
|
|
define i32 @test5(i32 %X, i32 %Y) {
|
2010-10-23 00:01:56 +02:00
|
|
|
%tmp17 = and i32 %X, -65536
|
|
|
|
%tmp2 = bitcast i32 %Y to i32
|
|
|
|
%tmp4 = lshr i32 %tmp2, 16
|
|
|
|
%tmp5 = or i32 %tmp4, %tmp17
|
2008-02-17 21:02:20 +01:00
|
|
|
ret i32 %tmp5
|
2007-01-19 10:20:23 +01:00
|
|
|
}
|
|
|
|
|
2010-08-16 19:05:27 +02:00
|
|
|
; CHECK: test5a
|
|
|
|
; CHECK: pkhtb r0, r0, r1, asr #16
|
2008-02-17 21:02:20 +01:00
|
|
|
define i32 @test5a(i32 %X, i32 %Y) {
|
2010-10-23 00:01:56 +02:00
|
|
|
%tmp110 = and i32 %X, -65536
|
|
|
|
%tmp37 = lshr i32 %Y, 16
|
|
|
|
%tmp39 = bitcast i32 %tmp37 to i32
|
|
|
|
%tmp5 = or i32 %tmp39, %tmp110
|
2008-02-17 21:02:20 +01:00
|
|
|
ret i32 %tmp5
|
2007-01-19 10:20:23 +01:00
|
|
|
}
|
|
|
|
|
2010-08-16 19:05:27 +02:00
|
|
|
; CHECK: test6
|
|
|
|
; CHECK: pkhtb r0, r0, r1, asr #12
|
2008-02-17 21:02:20 +01:00
|
|
|
define i32 @test6(i32 %X, i32 %Y) {
|
2010-10-23 00:01:56 +02:00
|
|
|
%tmp1 = and i32 %X, -65536
|
|
|
|
%tmp37 = lshr i32 %Y, 12
|
|
|
|
%tmp38 = bitcast i32 %tmp37 to i32
|
|
|
|
%tmp4 = and i32 %tmp38, 65535
|
|
|
|
%tmp59 = or i32 %tmp4, %tmp1
|
2008-02-17 21:02:20 +01:00
|
|
|
ret i32 %tmp59
|
2007-01-19 10:20:23 +01:00
|
|
|
}
|
|
|
|
|
2010-08-16 19:05:27 +02:00
|
|
|
; CHECK: test7
|
|
|
|
; CHECK: pkhtb r0, r0, r1, asr #18
|
2008-02-17 21:02:20 +01:00
|
|
|
define i32 @test7(i32 %X, i32 %Y) {
|
2010-10-23 00:01:56 +02:00
|
|
|
%tmp1 = and i32 %X, -65536
|
|
|
|
%tmp3 = ashr i32 %Y, 18
|
|
|
|
%tmp4 = and i32 %tmp3, 65535
|
|
|
|
%tmp57 = or i32 %tmp4, %tmp1
|
2008-02-17 21:02:20 +01:00
|
|
|
ret i32 %tmp57
|
2007-01-19 10:20:23 +01:00
|
|
|
}
|
2010-08-17 00:26:55 +02:00
|
|
|
|
2013-07-05 20:28:39 +02:00
|
|
|
; Arithmetic and logic right shift does not have the same semantics if shifting
|
|
|
|
; by more than 16 in this context.
|
|
|
|
|
2010-08-17 00:26:55 +02:00
|
|
|
; CHECK: test8
|
2013-07-05 20:28:39 +02:00
|
|
|
; CHECK-NOT: pkhtb r0, r0, r1, asr #22
|
2010-08-17 00:26:55 +02:00
|
|
|
define i32 @test8(i32 %X, i32 %Y) {
|
|
|
|
%tmp1 = and i32 %X, -65536
|
|
|
|
%tmp3 = lshr i32 %Y, 22
|
|
|
|
%tmp57 = or i32 %tmp3, %tmp1
|
|
|
|
ret i32 %tmp57
|
|
|
|
}
|
2013-07-05 20:28:39 +02:00
|
|
|
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test9:
|
2013-07-05 20:28:39 +02:00
|
|
|
; CHECK: pkhtb r0, r0, r1, asr #16
|
|
|
|
define i32 @test9(i32 %src1, i32 %src2) {
|
|
|
|
entry:
|
|
|
|
%tmp = and i32 %src1, -65536
|
|
|
|
%tmp2 = lshr i32 %src2, 16
|
|
|
|
%tmp3 = or i32 %tmp, %tmp2
|
|
|
|
ret i32 %tmp3
|
|
|
|
}
|
2013-07-05 20:57:49 +02:00
|
|
|
|
2013-07-13 22:38:47 +02:00
|
|
|
; CHECK-LABEL: test10:
|
2013-07-05 20:57:49 +02:00
|
|
|
; CHECK: pkhtb r0, r0, r1, asr #17
|
|
|
|
define i32 @test10(i32 %src1, i32 %src2) {
|
|
|
|
entry:
|
|
|
|
%tmp = and i32 %src1, -65536
|
|
|
|
%tmp2 = ashr i32 %src2, 17
|
|
|
|
%tmp3 = or i32 %tmp, %tmp2
|
|
|
|
ret i32 %tmp3
|
|
|
|
}
|