From: Krzysztof Parzyszek Date: Mon, 23 Oct 2017 19:07:50 +0000 (+0000) Subject: [Hexagon] Add extra pattern for S4_addaddi X-Git-Tag: android-x86-7.1-r4~9424 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0344b6624ee040ef603f90bf463367309257335f;p=android-x86%2Fexternal-llvm.git [Hexagon] Add extra pattern for S4_addaddi One combination was missing: add(add(x,y),c). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316363 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Hexagon/HexagonPatterns.td b/lib/Target/Hexagon/HexagonPatterns.td index 89be3bd5d04..908355700ec 100644 --- a/lib/Target/Hexagon/HexagonPatterns.td +++ b/lib/Target/Hexagon/HexagonPatterns.td @@ -1310,6 +1310,8 @@ def: AccRRR_pat>, I32, I32>; let AddedComplexity = 30 in { def: Pat<(add I32:$Rs, (Su I32:$Ru, anyimm:$s6)), (S4_addaddi IntRegs:$Rs, IntRegs:$Ru, imm:$s6)>; + def: Pat<(add anyimm:$s6, (Su I32:$Rs, I32:$Ru)), + (S4_addaddi IntRegs:$Rs, IntRegs:$Ru, imm:$s6)>; def: Pat<(add I32:$Rs, (Su anyimm:$s6, I32:$Ru)), (S4_subaddi IntRegs:$Rs, imm:$s6, IntRegs:$Ru)>; def: Pat<(sub (Su I32:$Rs, anyimm:$s6), I32:$Ru), diff --git a/test/CodeGen/Hexagon/addaddi.ll b/test/CodeGen/Hexagon/addaddi.ll new file mode 100644 index 00000000000..6510858f1bd --- /dev/null +++ b/test/CodeGen/Hexagon/addaddi.ll @@ -0,0 +1,13 @@ +; RUN: llc -march=hexagon < %s | FileCheck %s +; Check for S4_addaddi: +; CHECK: r{{[0-9]+}} = add(r{{[0-9]+}},add(r{{[0-9]+}},#2)) + +define i32 @fred(i32 %a0, i32 %a1, i32* nocapture %a2) #0 { +b3: + %v4 = add nsw i32 %a0, 2 + %v5 = add nsw i32 %v4, %a1 + store i32 %v5, i32* %a2, align 4 + ret i32 undef +} + +attributes #0 = { nounwind }