@@ -3151,29 +3151,41 @@ define pcodeop lswxOp;
3151
3151
cr1flags();
3152
3152
}
3153
3153
3154
- # This instruction is not exclusive to 64 bit processors, per page 1259 of the PowerISA manual.
3155
- # However, it does seem to require 64 bit registers, so it is currently restricted to 64 bit machines.
3154
+ # This instruction is not exclusive to 64 bit processors, per page 1405 of the PowerISA manual.
3155
+ # Prior to the Power ISA introduction, PowerPC architecture had 32-bit versions of the MSR in 32-bit implementations.
3156
+ # Since this instruction requires 64-bit processsors, it is currently restricted to 64 bit machines.
3157
+ # mtmsrd varies from processor to processor. This version is consistent with PowerISA v2.07B
3156
3158
@ifdef BIT_64
3157
3159
#mtmsrd r0,0 0x7c 00 01 64
3158
3160
:mtmsrd S,0 is $(NOTVLE) & OP=31 & S & BITS_17_20=0 & MSR_L=0 & BITS_11_15=0 & XOP_1_10=178 & BIT_0=0
3159
3161
{
3160
- bit0:8 = S >> 63 & 1;
3161
- bit1:8 = S >> 62 & 1;
3162
- bit49:8 = (S >> 14)& 1;
3163
- bit59:8 = (S >> 4) & 1;
3164
- tmp:8 = S & 0x6fffffffffff6fcf;
3165
- tmp = tmp & ((bit0 | bit1) << 63);
3166
- tmp = tmp & ((bit59 | bit49) << 5);
3167
- MSR = MSR & 0xefffffff00009020 | tmp;
3162
+ local bit59:$(REGISTER_SIZE) = (S >> 4) & 1; #bit 59
3163
+ local bit58:$(REGISTER_SIZE) = (S >> 5) & 1; #bit 58
3164
+ local bit49:$(REGISTER_SIZE) = (S >> 14) & 1; #bit 49
3165
+ local bit48:$(REGISTER_SIZE) = (S >> 15) & 1; #bit 48
3166
+
3167
+ local bits2931:$(REGISTER_SIZE) = zext(S[32,3]); #bits 29-31
3168
+ local mbits2931:$(REGISTER_SIZE) = zext(MSR[32,3]); #bits 29-31
3169
+ local cond = (mbits2931 != 0x2)|(bits2931 != 0);
3170
+ bits2931 = (zext(cond) * bits2931) + (zext(!cond) * mbits2931);
3171
+ local mask:$(REGISTER_SIZE) =0xeffffff8ffff6fce;
3172
+ tmp:8 = S & mask; #preserves (RS) 0:2 4:40 42:47 49:50 52:57 60:62
3173
+
3174
+ tmp = tmp | (bits2931) << 32;
3175
+ tmp = tmp | ((bit48 | bit49) << 15); # MSR 48 <- (RS) 48 | (RS) 49
3176
+ tmp = tmp | ((bit58 | bit49) << 5); # MSR 58 <- (RS) 58 | (RS) 49
3177
+ tmp = tmp | ((bit59 | bit49) << 4); # MSR 59 <- (RS) 59 | (RS) 49
3178
+ MSR = (MSR & ~mask) | tmp;
3168
3179
}
3169
3180
3170
3181
#mtmsrd r0,1 0x7c 01 01 64
3171
3182
:mtmsrd S,1 is $(NOTVLE) & OP=31 & S & BITS_17_20=0 & MSR_L=1 & BITS_11_15=0 & XOP_1_10=178 & BIT_0=0
3172
3183
{
3173
- mask:8 = 0x000000000000fffe & S ;
3184
+ mask:$(REGISTER_SIZE) = 0x8002 ;
3174
3185
MSR = (MSR & ~mask) | (S & mask);
3175
3186
}
3176
3187
@endif
3188
+
3177
3189
CRM_val: crmval is CRM [crmval = CRM+0;] {export *[const]:1 crmval;}
3178
3190
#mtocrf 10,r0 0x7c 21 01 20
3179
3191
:mtocrf CRM_val,S is OP=31 & S & BIT_20=1 & CRM_val & CRM0 & CRM1 & CRM2 & CRM3 & CRM4 & CRM5 & CRM6 & CRM7 & BIT_11=0 & XOP_1_10=144 & BIT_0=0
0 commit comments