[PATCH] D43179: [Thumb] Handle addressing mode AddrMode5FP16
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 02:32:50 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324996: [Thumb] Handle addressing mode AddrMode5FP16 (authored by SjoerdMeijer, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D43179?vs=133911&id=134015#toc
Repository:
rL LLVM
https://reviews.llvm.org/D43179
Files:
llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp
llvm/trunk/test/CodeGen/ARM/fp16-instructions.ll
Index: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp
+++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp
@@ -600,6 +600,20 @@
Offset = -Offset;
isSub = true;
}
+ } else if (AddrMode == ARMII::AddrMode5FP16) {
+ // VFP address mode.
+ const MachineOperand &OffOp = MI.getOperand(FrameRegIdx+1);
+ int InstrOffs = ARM_AM::getAM5FP16Offset(OffOp.getImm());
+ if (ARM_AM::getAM5FP16Op(OffOp.getImm()) == ARM_AM::sub)
+ InstrOffs *= -1;
+ NumBits = 8;
+ Scale = 2;
+ Offset += InstrOffs * 2;
+ assert((Offset & (Scale-1)) == 0 && "Can't encode this offset!");
+ if (Offset < 0) {
+ Offset = -Offset;
+ isSub = true;
+ }
} else if (AddrMode == ARMII::AddrModeT2_i8s4) {
Offset += MI.getOperand(FrameRegIdx + 1).getImm() * 4;
NumBits = 10; // 8 bits scaled by 4
Index: llvm/trunk/test/CodeGen/ARM/fp16-instructions.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/fp16-instructions.ll
+++ llvm/trunk/test/CodeGen/ARM/fp16-instructions.ll
@@ -695,3 +695,27 @@
; CHECK-HARDFP-FULLFP16: vsub.f16 s0, s0, s1
}
+
+; Check for VSTRH with a FCONSTH, this checks that addressing mode
+; AddrMode5FP16 is supported.
+define i32 @ThumbAddrMode5FP16(i32 %A.coerce) {
+entry:
+ %S = alloca half, align 2
+ %tmp.0.extract.trunc = trunc i32 %A.coerce to i16
+ %0 = bitcast i16 %tmp.0.extract.trunc to half
+ %S.0.S.0..sroa_cast = bitcast half* %S to i8*
+ store volatile half 0xH3C00, half* %S, align 2
+ %S.0.S.0. = load volatile half, half* %S, align 2
+ %add = fadd half %S.0.S.0., %0
+ %1 = bitcast half %add to i16
+ %tmp2.0.insert.ext = zext i16 %1 to i32
+ ret i32 %tmp2.0.insert.ext
+
+; CHECK-LABEL: ThumbAddrMode5FP16
+
+; CHECK-SOFTFP-FULLFP16: vmov.f16 [[S0:s[0-9]]], #1.000000e+00
+; CHECK-SOFTFP-FULLFP16: vstr.16 [[S0]], [sp, #{{.}}]
+; CHECK-SOFTFP-FULLFP16: vmov.f16 [[S0_2:s[0-9]]], r0
+; CHECK-SOFTFP-FULLFP16: vldr.16 [[S2:s[0-9]]], [sp, #{{.}}]
+; CHECK-SOFTFP-FULLFP16: vadd.f16 s{{.}}, [[S2]], [[S0_2]]
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43179.134015.patch
Type: text/x-patch
Size: 2250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180213/c9f6cf31/attachment.bin>
More information about the llvm-commits
mailing list