// lsl is an alias for UXTW but will be a parsed as a k_Shifter operand.
if (isShifter()) {
ARM64_AM::ShiftType ST = ARM64_AM::getShiftType(Shifter.Val);
- return ST == ARM64_AM::LSL;
+ return ST == ARM64_AM::LSL &&
+ ARM64_AM::getShiftValue(Shifter.Val) <= 4;
}
return Kind == k_Extend && ARM64_AM::getArithShiftValue(Shifter.Val) <= 4;
}
// lsl is an alias for UXTX but will be a parsed as a k_Shifter operand.
if (isShifter()) {
ARM64_AM::ShiftType ST = ARM64_AM::getShiftType(Shifter.Val);
- return ST == ARM64_AM::LSL;
+ return ST == ARM64_AM::LSL &&
+ ARM64_AM::getShiftValue(Shifter.Val) <= 4;
}
if (Kind != k_Extend)
return false;
ARM64_AM::getArithShiftValue(Shifter.Val) <= 4;
}
+ template <unsigned width>
bool isArithmeticShifter() const {
if (!isShifter())
return false;
// An arithmetic shifter is LSL, LSR, or ASR.
ARM64_AM::ShiftType ST = ARM64_AM::getShiftType(Shifter.Val);
- return ST == ARM64_AM::LSL || ST == ARM64_AM::LSR || ST == ARM64_AM::ASR;
+ return (ST == ARM64_AM::LSL || ST == ARM64_AM::LSR ||
+ ST == ARM64_AM::ASR) && ARM64_AM::getShiftValue(Shifter.Val) < width;
}
bool isMovImm32Shifter() const {
return MatchOperand_ParseFail;
}
- SMLoc ExprLoc = getLoc();
const MCExpr *ImmVal;
if (getParser().parseExpression(ImmVal))
return MatchOperand_ParseFail;
return MatchOperand_ParseFail;
}
+ SMLoc E = SMLoc::getFromPointer(getLoc().getPointer() - 1);
+
+ // If we have an shift that is too large to encode then crudely pass it
+ // through as an invalid shift that is encodable so that we get consistant
+ // diagnostics rather than ones different from out of range 32-bit shifts.
if ((MCE->getValue() & 0x3f) != MCE->getValue()) {
- Error(ExprLoc, "immediate value too large for shifter operand");
- return MatchOperand_ParseFail;
+ Operands.push_back(ARM64Operand::CreateShifter(ARM64_AM::InvalidShift, 0, S,
+ E, getContext()));
+ } else {
+ Operands.push_back(ARM64Operand::CreateShifter(ShOp, MCE->getValue(), S,
+ E, getContext()));
}
- SMLoc E = SMLoc::getFromPointer(getLoc().getPointer() - 1);
- Operands.push_back(
- ARM64Operand::CreateShifter(ShOp, MCE->getValue(), S, E, getContext()));
return MatchOperand_Success;
}
add x12, x13, x14
add w12, w13, w14, lsl #12
add x12, x13, x14, lsl #12
- add w12, w13, w14, lsr #42
add x12, x13, x14, lsr #42
- add w12, w13, w14, asr #39
add x12, x13, x14, asr #39
; CHECK: add w12, w13, w14 ; encoding: [0xac,0x01,0x0e,0x0b]
; CHECK: add x12, x13, x14 ; encoding: [0xac,0x01,0x0e,0x8b]
; CHECK: add w12, w13, w14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x0b]
; CHECK: add x12, x13, x14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x8b]
-; CHECK: add w12, w13, w14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0x0b]
; CHECK: add x12, x13, x14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0x8b]
-; CHECK: add w12, w13, w14, asr #39 ; encoding: [0xac,0x9d,0x8e,0x0b]
; CHECK: add x12, x13, x14, asr #39 ; encoding: [0xac,0x9d,0x8e,0x8b]
sub w12, w13, w14
sub x12, x13, x14
sub w12, w13, w14, lsl #12
sub x12, x13, x14, lsl #12
- sub w12, w13, w14, lsr #42
sub x12, x13, x14, lsr #42
- sub w12, w13, w14, asr #39
sub x12, x13, x14, asr #39
; CHECK: sub w12, w13, w14 ; encoding: [0xac,0x01,0x0e,0x4b]
; CHECK: sub x12, x13, x14 ; encoding: [0xac,0x01,0x0e,0xcb]
; CHECK: sub w12, w13, w14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x4b]
; CHECK: sub x12, x13, x14, lsl #12 ; encoding: [0xac,0x31,0x0e,0xcb]
-; CHECK: sub w12, w13, w14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0x4b]
; CHECK: sub x12, x13, x14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0xcb]
-; CHECK: sub w12, w13, w14, asr #39 ; encoding: [0xac,0x9d,0x8e,0x4b]
; CHECK: sub x12, x13, x14, asr #39 ; encoding: [0xac,0x9d,0x8e,0xcb]
adds w12, w13, w14
adds x12, x13, x14
adds w12, w13, w14, lsl #12
adds x12, x13, x14, lsl #12
- adds w12, w13, w14, lsr #42
adds x12, x13, x14, lsr #42
- adds w12, w13, w14, asr #39
adds x12, x13, x14, asr #39
; CHECK: adds w12, w13, w14 ; encoding: [0xac,0x01,0x0e,0x2b]
; CHECK: adds x12, x13, x14 ; encoding: [0xac,0x01,0x0e,0xab]
; CHECK: adds w12, w13, w14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x2b]
; CHECK: adds x12, x13, x14, lsl #12 ; encoding: [0xac,0x31,0x0e,0xab]
-; CHECK: adds w12, w13, w14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0x2b]
; CHECK: adds x12, x13, x14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0xab]
-; CHECK: adds w12, w13, w14, asr #39 ; encoding: [0xac,0x9d,0x8e,0x2b]
; CHECK: adds x12, x13, x14, asr #39 ; encoding: [0xac,0x9d,0x8e,0xab]
subs w12, w13, w14
subs x12, x13, x14
subs w12, w13, w14, lsl #12
subs x12, x13, x14, lsl #12
- subs w12, w13, w14, lsr #42
subs x12, x13, x14, lsr #42
- subs w12, w13, w14, asr #39
subs x12, x13, x14, asr #39
; CHECK: subs w12, w13, w14 ; encoding: [0xac,0x01,0x0e,0x6b]
; CHECK: subs x12, x13, x14 ; encoding: [0xac,0x01,0x0e,0xeb]
; CHECK: subs w12, w13, w14, lsl #12 ; encoding: [0xac,0x31,0x0e,0x6b]
; CHECK: subs x12, x13, x14, lsl #12 ; encoding: [0xac,0x31,0x0e,0xeb]
-; CHECK: subs w12, w13, w14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0x6b]
; CHECK: subs x12, x13, x14, lsr #42 ; encoding: [0xac,0xa9,0x4e,0xeb]
-; CHECK: subs w12, w13, w14, asr #39 ; encoding: [0xac,0x9d,0x8e,0x6b]
; CHECK: subs x12, x13, x14, asr #39 ; encoding: [0xac,0x9d,0x8e,0xeb]
; Check use of upper case register names rdar://14354073