From fe3b2995aa38b25bada9fa2e850590b3988668b5 Mon Sep 17 00:00:00 2001 From: Arnold Schwaighofer Date: Fri, 5 Jul 2013 18:57:49 +0000 Subject: [PATCH] ARM: Add a pack pattern for matching arithmetic shift right git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185714 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMInstrInfo.td | 3 +++ test/CodeGen/ARM/pack.ll | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td index 75d3de94059..9eba5534238 100644 --- a/lib/Target/ARM/ARMInstrInfo.td +++ b/lib/Target/ARM/ARMInstrInfo.td @@ -4016,6 +4016,9 @@ def PKHTB : APKHI<0b01101000, 1, (outs GPRnopc:$Rd), def : ARMV6Pat<(or (and GPRnopc:$src1, 0xFFFF0000), (srl GPRnopc:$src2, imm16:$sh)), (PKHTB GPRnopc:$src1, GPRnopc:$src2, imm16:$sh)>; +def : ARMV6Pat<(or (and GPRnopc:$src1, 0xFFFF0000), + (sra GPRnopc:$src2, imm16_31:$sh)), + (PKHTB GPRnopc:$src1, GPRnopc:$src2, imm16_31:$sh)>; def : ARMV6Pat<(or (and GPRnopc:$src1, 0xFFFF0000), (and (srl GPRnopc:$src2, imm1_15:$sh), 0xFFFF)), (PKHTB GPRnopc:$src1, GPRnopc:$src2, imm1_15:$sh)>; diff --git a/test/CodeGen/ARM/pack.ll b/test/CodeGen/ARM/pack.ll index b94414328ca..f6cc75e04f0 100644 --- a/test/CodeGen/ARM/pack.ll +++ b/test/CodeGen/ARM/pack.ll @@ -99,3 +99,13 @@ entry: %tmp3 = or i32 %tmp, %tmp2 ret i32 %tmp3 } + +; CHECK: test10: +; 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 +} -- 2.34.1