summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/sbfx.ll
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-07-23 13:59:12 +0000
committerTim Northover <tnorthover@apple.com>2014-07-23 13:59:12 +0000
commit14ff2df05c241297f0139f46c825dc333eea4b9c (patch)
tree92aaedf747b72e7831feee41019ded4140aa8f7d /llvm/test/CodeGen/ARM/sbfx.ll
parent7ad2a0e0c2bc323649507e72b112ad2060be100c (diff)
downloadbcm5719-llvm-14ff2df05c241297f0139f46c825dc333eea4b9c.tar.gz
bcm5719-llvm-14ff2df05c241297f0139f46c825dc333eea4b9c.zip
ARM: spot SBFX-compatbile code expressed with sign_extend_inreg
We were assuming all SBFX-like operations would have the shl/asr form, but often when the field being extracted is an i8 or i16, we end up with a SIGN_EXTEND_INREG acting on a shift instead. Simple enough to check for though. llvm-svn: 213754
Diffstat (limited to 'llvm/test/CodeGen/ARM/sbfx.ll')
-rw-r--r--llvm/test/CodeGen/ARM/sbfx.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/sbfx.ll b/llvm/test/CodeGen/ARM/sbfx.ll
index 3c25edcaa75..5b77c59bca9 100644
--- a/llvm/test/CodeGen/ARM/sbfx.ll
+++ b/llvm/test/CodeGen/ARM/sbfx.ll
@@ -45,3 +45,21 @@ entry:
%tmp2 = ashr i32 %tmp, 1
ret i32 %tmp2
}
+
+define signext i8 @f6(i32 %a) {
+; CHECK-LABEL: f6:
+; CHECK: sbfx r0, r0, #23, #8
+
+ %tmp = lshr i32 %a, 23
+ %res = trunc i32 %tmp to i8
+ ret i8 %res
+}
+
+define signext i8 @f7(i32 %a) {
+; CHECK-LABEL: f7:
+; CHECK-NOT: sbfx
+
+ %tmp = lshr i32 %a, 25
+ %res = trunc i32 %tmp to i8
+ ret i8 %res
+}
OpenPOWER on IntegriCloud