File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
asm/internal/asm/testdata Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ TEXT validation(SB),$0
1212 SRLI $1 , X5, F1 // ERROR "expected integer register in rd position but got non-integer register F1"
1313 SRLI $1 , F1, X5 // ERROR "expected integer register in rs1 position but got non-integer register F1"
1414
15+ WORD $-1 // ERROR "must be in range [0x0, 0xffffffff]"
16+ WORD $0x100000000 // ERROR "must be in range [0x0, 0xffffffff]"
17+
1518 //
1619 // "V" Standard Extension for Vector Operations, Version 1.0
1720 //
Original file line number Diff line number Diff line change @@ -1419,9 +1419,7 @@ func validateVsetvl(ctxt *obj.Link, ins *instruction) {
14191419func validateRaw (ctxt * obj.Link , ins * instruction ) {
14201420 // Treat the raw value specially as a 32-bit unsigned integer.
14211421 // Nobody wants to enter negative machine code.
1422- if ins .imm < 0 || 1 << 32 <= ins .imm {
1423- ctxt .Diag ("%v: immediate %d in raw position cannot be larger than 32 bits" , ins .as , ins .imm )
1424- }
1422+ wantImmU (ctxt , ins , ins .imm , 32 )
14251423}
14261424
14271425// extractBitAndShift extracts the specified bit from the given immediate,
@@ -1706,10 +1704,7 @@ func encodeVsetvl(ins *instruction) uint32 {
17061704func encodeRawIns (ins * instruction ) uint32 {
17071705 // Treat the raw value specially as a 32-bit unsigned integer.
17081706 // Nobody wants to enter negative machine code.
1709- if ins .imm < 0 || 1 << 32 <= ins .imm {
1710- panic (fmt .Sprintf ("immediate %d cannot fit in 32 bits" , ins .imm ))
1711- }
1712- return uint32 (ins .imm )
1707+ return immU (ins .as , ins .imm , 32 )
17131708}
17141709
17151710func EncodeBImmediate (imm int64 ) (int64 , error ) {
You can’t perform that action at this time.
0 commit comments