[llvm] r355191 - [ARM GlobalISel] Support G_CTLZ for Thumb2
Diana Picus via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 02:12:28 PST 2019
Author: rovka
Date: Fri Mar 1 02:12:28 2019
New Revision: 355191
URL: http://llvm.org/viewvc/llvm-project?rev=355191&view=rev
Log:
[ARM GlobalISel] Support G_CTLZ for Thumb2
Same as ARM mode but with different opcode.
Added:
llvm/trunk/test/CodeGen/ARM/GlobalISel/select-clz.mir
Modified:
llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp
llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-bitcounts.mir
Modified: llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp?rev=355191&r1=355190&r2=355191&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMLegalizerInfo.cpp Fri Mar 1 02:12:28 2019
@@ -206,13 +206,6 @@ ARMLegalizerInfo::ARMLegalizerInfo(const
getActionDefinitionsBuilder({G_FREM, G_FPOW}).libcallFor({s32, s64});
- if (ST.isThumb()) {
- // FIXME: merge with the code for non-Thumb.
- computeTables();
- verify(*ST.getInstrInfo());
- return;
- }
-
if (ST.hasV5TOps()) {
getActionDefinitionsBuilder(G_CTLZ)
.legalFor({s32, s32})
Modified: llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-bitcounts.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-bitcounts.mir?rev=355191&r1=355190&r2=355191&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-bitcounts.mir (original)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-legalize-bitcounts.mir Fri Mar 1 02:12:28 2019
@@ -1,4 +1,5 @@
# RUN: llc -O0 -mtriple arm-linux-gnueabi -mattr=+v5t -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,CLZ
+# RUN: llc -O0 -mtriple thumb-linux-gnueabi -mattr=+v6t2 -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,CLZ
# RUN: llc -O0 -mtriple arm-linux-gnueabi -mattr=-v5t -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,LIBCALLS
--- |
define void @test_ctlz_s32() { ret void }
Added: llvm/trunk/test/CodeGen/ARM/GlobalISel/select-clz.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/select-clz.mir?rev=355191&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/select-clz.mir (added)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/select-clz.mir Fri Mar 1 02:12:28 2019
@@ -0,0 +1,33 @@
+# RUN: llc -O0 -mtriple arm-- -mattr=+v6 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,ARM
+# RUN: llc -O0 -mtriple thumb-- -mattr=+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,THUMB
+--- |
+ define void @test_clz() { ret void }
+...
+---
+name: test_clz
+# CHECK-LABEL: name: test_clz
+legalized: true
+regBankSelected: true
+selected: false
+# CHECK: selected: true
+registers:
+ - { id: 0, class: gprb }
+ - { id: 1, class: gprb }
+body: |
+ bb.0:
+ liveins: $r0
+
+ %0(s32) = COPY $r0
+ ; ARM: [[VREGX:%[0-9]+]]:gpr = COPY $r0
+ ; THUMB: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
+
+ %1(s32) = G_CTLZ %0(s32)
+ ; ARM: [[VREGR:%[0-9]+]]:gpr = CLZ [[VREGX]], 14, $noreg
+ ; THUMB: [[VREGR:%[0-9]+]]:rgpr = t2CLZ [[VREGX]], 14, $noreg
+
+ $r0 = COPY %1(s32)
+ ; CHECK: $r0 = COPY [[VREGR]]
+
+ BX_RET 14, $noreg, implicit $r0
+ ; CHECK: BX_RET 14, $noreg, implicit $r0
+...
More information about the llvm-commits
mailing list