mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-26 10:29:36 +00:00
[SystemZ] Extend pseudo conditional 8- and 16-bit stores to high words
As the comment says, we always want to use STOC for 32-bit stores. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191767 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bba9390fc6
commit
00f5335ea0
@ -2893,6 +2893,14 @@ EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const {
|
||||
case SystemZ::SelectF128:
|
||||
return emitSelect(MI, MBB);
|
||||
|
||||
case SystemZ::CondStore8Mux:
|
||||
return emitCondStore(MI, MBB, SystemZ::STCMux, 0, false);
|
||||
case SystemZ::CondStore8MuxInv:
|
||||
return emitCondStore(MI, MBB, SystemZ::STCMux, 0, true);
|
||||
case SystemZ::CondStore16Mux:
|
||||
return emitCondStore(MI, MBB, SystemZ::STHMux, 0, false);
|
||||
case SystemZ::CondStore16MuxInv:
|
||||
return emitCondStore(MI, MBB, SystemZ::STHMux, 0, true);
|
||||
case SystemZ::CondStore8:
|
||||
return emitCondStore(MI, MBB, SystemZ::STC, 0, false);
|
||||
case SystemZ::CondStore8Inv:
|
||||
|
@ -202,6 +202,14 @@ def Select32Mux : SelectWrapper<GRX32>, Requires<[FeatureHighWord]>;
|
||||
def Select32 : SelectWrapper<GR32>;
|
||||
def Select64 : SelectWrapper<GR64>;
|
||||
|
||||
// We don't define 32-bit Mux stores because the low-only STOC should
|
||||
// always be used if possible.
|
||||
defm CondStore8Mux : CondStores<GRX32, nonvolatile_truncstorei8,
|
||||
nonvolatile_anyextloadi8, bdxaddr20only>,
|
||||
Requires<[FeatureHighWord]>;
|
||||
defm CondStore16Mux : CondStores<GRX32, nonvolatile_truncstorei16,
|
||||
nonvolatile_anyextloadi16, bdxaddr20only>,
|
||||
Requires<[FeatureHighWord]>;
|
||||
defm CondStore8 : CondStores<GR32, nonvolatile_truncstorei8,
|
||||
nonvolatile_anyextloadi8, bdxaddr20only>;
|
||||
defm CondStore16 : CondStores<GR32, nonvolatile_truncstorei16,
|
||||
|
@ -28,3 +28,35 @@ define void @f2(float %val, i8 *%ptr) {
|
||||
store i8 %trunc, i8 *%ptr
|
||||
ret void
|
||||
}
|
||||
|
||||
; Like f2, but with a conditional store.
|
||||
define void @f3(float %val, i8 *%ptr, i32 %which) {
|
||||
; CHECK-LABEL: f3:
|
||||
; CHECK: cijlh %r3, 0,
|
||||
; CHECK: lgdr [[REG:%r[0-5]]], %f0
|
||||
; CHECK: stch [[REG]], 0(%r2)
|
||||
; CHECK: br %r14
|
||||
%int = bitcast float %val to i32
|
||||
%trunc = trunc i32 %int to i8
|
||||
%old = load i8 *%ptr
|
||||
%cmp = icmp eq i32 %which, 0
|
||||
%res = select i1 %cmp, i8 %trunc, i8 %old
|
||||
store i8 %res, i8 *%ptr
|
||||
ret void
|
||||
}
|
||||
|
||||
; ...and again with 16-bit memory.
|
||||
define void @f4(float %val, i16 *%ptr, i32 %which) {
|
||||
; CHECK-LABEL: f4:
|
||||
; CHECK: cijlh %r3, 0,
|
||||
; CHECK: lgdr [[REG:%r[0-5]]], %f0
|
||||
; CHECK: sthh [[REG]], 0(%r2)
|
||||
; CHECK: br %r14
|
||||
%int = bitcast float %val to i32
|
||||
%trunc = trunc i32 %int to i16
|
||||
%old = load i16 *%ptr
|
||||
%cmp = icmp eq i32 %which, 0
|
||||
%res = select i1 %cmp, i16 %trunc, i16 %old
|
||||
store i16 %res, i16 *%ptr
|
||||
ret void
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user