Summary:
Partial write %PSR (WRPSR) is a SPARC V8e option that allows WRPSR
instructions to only affect the %PSR.ET field. It is supported by
the GR740 and GR716.
Reviewers: jyknight, venkatra
Subscribers: fedor.sergeev, jrtc27, llvm-commits
Differential Revision: https://reviews.llvm.org/D48644
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343202
91177308-0d34-0410-b5e6-
96231b3b80d8
def FeatureLeon
: SubtargetFeature<"leon", "IsLeon", "true",
"Enable LEON extensions">;
+def FeaturePWRPSR
+ : SubtargetFeature<"leonpwrpsr", "HasPWRPSR", "true",
+ "Enable the PWRPSR instruction">;
def FeatureHardQuad
: SubtargetFeature<"hard-quad-float", "HasHardQuad", "true",
// LEON 4 FT (GR740)
// TO DO: Place-holder: Processor specific features will be added *very* soon here.
def : Processor<"gr740", LEON4Itineraries,
- [FeatureLeon, UMACSMACSupport, LeonCASA, LeonCycleCounter]>;
+ [FeatureLeon, UMACSMACSupport, LeonCASA, LeonCycleCounter,
+ FeaturePWRPSR]>;
//===----------------------------------------------------------------------===//
// Declare the target which we are implementing
def : InstAlias<"wr $rs2, %tbr", (WRTBRrr G0, IntRegs:$rs2), 0>;
def : InstAlias<"wr $simm13, %tbr", (WRTBRri G0, i32imm:$simm13), 0>;
+def : InstAlias<"pwr $rs2, %psr", (PWRPSRrr G0, IntRegs:$rs2), 0>;
+def : InstAlias<"pwr $simm13, %psr", (PWRPSRri G0, i32imm:$simm13), 0>;
// flush -> flush %g0
def : InstAlias<"flush", (FLUSH), 0>;
// instruction
def HasLeonCASA : Predicate<"Subtarget->hasLeonCasa()">;
+// HasPWRPSR - This is true when the target processor supports partial
+// writes to the PSR register that only affects the ET field.
+def HasPWRPSR : Predicate<"Subtarget->hasPWRPSR()">,
+ AssemblerPredicate<"FeaturePWRPSR">;
+
// HasUMAC_SMAC - This is true when the target processor supports the
// UMAC and SMAC instructions
def HasUMAC_SMAC : Predicate<"Subtarget->hasUmacSmac()">;
[], IIC_smac_umac>;
}
+// The partial write WRPSR instruction has a non-zero destination
+// register value to separate it from the standard instruction.
+let Predicates = [HasPWRPSR], Defs = [PSR], rd=1 in {
+ def PWRPSRrr : F3_1<2, 0b110001,
+ (outs), (ins IntRegs:$rs1, IntRegs:$rs2),
+ "pwr $rs1, $rs2, %psr", []>;
+ def PWRPSRri : F3_2<2, 0b110001,
+ (outs), (ins IntRegs:$rs1, simm13Op:$simm13),
+ "pwr $rs1, $simm13, %psr", []>;
+}
+
let Defs = [ICC] in {
defm TADDCC : F3_12np<"taddcc", 0b100000>;
defm TSUBCC : F3_12np<"tsubcc", 0b100001>;
// Leon features
HasLeonCasa = false;
HasUmacSmac = false;
+ HasPWRPSR = false;
InsertNOPLoad = false;
FixAllFDIVSQRT = false;
DetectRoundChange = false;
// LEON features
bool HasUmacSmac;
bool HasLeonCasa;
+ bool HasPWRPSR;
bool InsertNOPLoad;
bool FixAllFDIVSQRT;
bool DetectRoundChange;
// Leon options
bool hasUmacSmac() const { return HasUmacSmac; }
bool hasLeonCasa() const { return HasLeonCasa; }
+ bool hasPWRPSR() const { return HasPWRPSR; }
bool insertNOPLoad() const { return InsertNOPLoad; }
bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; }
bool detectRoundChange() const { return DetectRoundChange; }
--- /dev/null
+! RUN: llvm-mc %s -arch=sparc -mcpu=gr740 -show-encoding | FileCheck %s
+
+ ! CHECK: pwr %g0, 0, %psr ! encoding: [0x83,0x88,0x20,0x00]
+ pwr 0, %psr
+
+ ! CHECK: pwr %g0, %l7, %psr ! encoding: [0x83,0x88,0x00,0x17]
+ pwr %l7, %psr
+
+ ! CHECK: pwr %g0, 32, %psr ! encoding: [0x83,0x88,0x20,0x20]
+ pwr 32, %psr