SRLI $1, X5, F1 // ERROR "expected integer register in rd position but got non-integer register F1"
SRLI $1, F1, X5 // ERROR "expected integer register in rs1 position but got non-integer register F1"
+ WORD $-1 // ERROR "must be in range [0x0, 0xffffffff]"
+ WORD $0x100000000 // ERROR "must be in range [0x0, 0xffffffff]"
+
//
// "V" Standard Extension for Vector Operations, Version 1.0
//
func validateRaw(ctxt *obj.Link, ins *instruction) {
// Treat the raw value specially as a 32-bit unsigned integer.
// Nobody wants to enter negative machine code.
- if ins.imm < 0 || 1<<32 <= ins.imm {
- ctxt.Diag("%v: immediate %d in raw position cannot be larger than 32 bits", ins.as, ins.imm)
- }
+ wantImmU(ctxt, ins, ins.imm, 32)
}
// extractBitAndShift extracts the specified bit from the given immediate,
func encodeRawIns(ins *instruction) uint32 {
// Treat the raw value specially as a 32-bit unsigned integer.
// Nobody wants to enter negative machine code.
- if ins.imm < 0 || 1<<32 <= ins.imm {
- panic(fmt.Sprintf("immediate %d cannot fit in 32 bits", ins.imm))
- }
- return uint32(ins.imm)
+ return immU(ins.as, ins.imm, 32)
}
func EncodeBImmediate(imm int64) (int64, error) {