[llvm] r257815 - [Hexagon] Use S2_lsr_i_r instead of S2_extractu to obtain upper halfword
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 14 13:59:23 PST 2016
Author: kparzysz
Date: Thu Jan 14 15:59:22 2016
New Revision: 257815
URL: http://llvm.org/viewvc/llvm-project?rev=257815&view=rev
Log:
[Hexagon] Use S2_lsr_i_r instead of S2_extractu to obtain upper halfword
Added:
llvm/trunk/test/CodeGen/Hexagon/bit-extractu-half.ll
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonBitSimplify.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonBitSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonBitSimplify.cpp?rev=257815&r1=257814&r2=257815&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonBitSimplify.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonBitSimplify.cpp Thu Jan 14 15:59:22 2016
@@ -1966,11 +1966,10 @@ bool BitSimplification::genExtractHalf(M
NewR = MRI.createVirtualRegister(&Hexagon::IntRegsRegClass);
BuildMI(B, At, DL, HII.get(Hexagon::A2_zxth), NewR)
.addReg(L.Reg, 0, L.Sub);
- } else if (!L.Low && Opc != Hexagon::S2_extractu) {
+ } else if (!L.Low && Opc != Hexagon::S2_lsr_i_r) {
NewR = MRI.createVirtualRegister(&Hexagon::IntRegsRegClass);
- BuildMI(B, MI, DL, HII.get(Hexagon::S2_extractu), NewR)
+ BuildMI(B, MI, DL, HII.get(Hexagon::S2_lsr_i_r), NewR)
.addReg(L.Reg, 0, L.Sub)
- .addImm(16)
.addImm(16);
}
if (NewR == 0)
Added: llvm/trunk/test/CodeGen/Hexagon/bit-extractu-half.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/bit-extractu-half.ll?rev=257815&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/bit-extractu-half.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/bit-extractu-half.ll Thu Jan 14 15:59:22 2016
@@ -0,0 +1,13 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+; Pick lsr (in bit-simplification) for extracting high halfword.
+; CHECK: lsr{{.*}}#16
+
+define i32 @foo(i32 %x) #0 {
+ %a = call i32 @llvm.hexagon.S2.extractu(i32 %x, i32 16, i32 16)
+ ret i32 %a
+}
+
+declare i32 @llvm.hexagon.S2.extractu(i32, i32, i32) #0
+
+attributes #0 = { nounwind readnone }
+
More information about the llvm-commits
mailing list