This repository has been archived by the owner on Aug 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aarch64: Add maximum immediate value to aarch64_sys_reg
The immediate form of MSR has a 4-bit immediate field (in CRm). However, many forms of MSR require a smaller immediate. These cases are identified by value in operand_general_constraint_met_p, but they're now the common case rather than the exception. This patch therefore adds the maximum value to the sys_reg description and gets the range from there. It also enforces the minimum of 0, which avoids a situation in which: msr dit, #2 would give the expected: Error: immediate value out of range 0 to 1 whereas: msr dit, #-1 would give: Error: immediate value out of range 0 to 15 (from the later UIMM4 checking). Also: - we were reporting the first error above against the wrong operand - TCO takes a single-bit immediate, but we previously allowed all 16 values. [https://developer.arm.com/documentation/ddi0596/2021-09/Base-Instructions/MSR--immediate---Move-immediate-value-to-Special-Register-?lang=en] opcodes/ * aarch64-opc.h (F_REG_MAX_VALUE, F_GET_REG_MAX_VALUE): New macros. * aarch64-opc.c (operand_general_constraint_met_p): Read the maximum MSR immediate value from aarch64_pstatefields. (aarch64_pstatefields): Add the maximum immediate value for each register. gas/ * testsuite/gas/aarch64/sysreg-4.s: Use an immediate value of 1 rather than 8 for the TCO test. * testsuite/gas/aarch64/sysreg-4.d: Update accordingly. * testsuite/gas/aarch64/armv8_2-a-illegal.l: Fix operand number in MSR immediate error messages. * testsuite/gas/aarch64/diagnostic.l: Likewise. * testsuite/gas/aarch64/pan-illegal.l: Likewise. * testsuite/gas/aarch64/ssbs-illegal1.l: Likewise. * testsuite/gas/aarch64/illegal-sysreg-4b.s, * testsuite/gas/aarch64/illegal-sysreg-4b.d, * testsuite/gas/aarch64/illegal-sysreg-4b.l: New test.
- Loading branch information
1 parent
96c7115
commit f96093c
Showing
11 changed files
with
92 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
[^:]+: Assembler messages: | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr uao,#2' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr uao,#3' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr uao,#4' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr uao,#5' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr uao,#8' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr uao,#15' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr uao,#19' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr uao,#31' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr uao,#2' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr uao,#3' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr uao,#4' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr uao,#5' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr uao,#8' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr uao,#15' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr uao,#19' | ||
[^:]+:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr uao,#31' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#as: -march=armv8-a | ||
#error_output: illegal-sysreg-4b.l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[^:]*: Assembler messages: | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr TCO,#-1' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr TCO,#2' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr TCO,#15' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr TCO,#0x100000000' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 15 at operand 2 -- `msr daifclr,#-1' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 15 at operand 2 -- `msr daifclr,#16' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 15 at operand 2 -- `msr daifclr,#0x200000000' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 15 at operand 2 -- `msr daifset,#-1' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 15 at operand 2 -- `msr daifset,#16' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 15 at operand 2 -- `msr daifset,#0x200000000' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.arch armv8.5-a+memtag | ||
|
||
msr TCO, #-1 | ||
msr TCO, #2 | ||
msr TCO, #15 | ||
msr TCO, #0x100000000 | ||
|
||
msr daifclr, #-1 | ||
msr daifclr, #16 | ||
msr daifclr, #0x200000000 | ||
|
||
msr daifset, #-1 | ||
msr daifset, #16 | ||
msr daifset, #0x200000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
[^:]*: Assembler messages: | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#2' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#3' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#4' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#5' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#6' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#7' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#8' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#9' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#10' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#11' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#12' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#13' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#14' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr pan,#15' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#2' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#3' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#4' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#5' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#6' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#7' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#8' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#9' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#10' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#11' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#12' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#13' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#14' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr pan,#15' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
[^:]*: Assembler messages: | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#2' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#3' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#4' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#5' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#6' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#7' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#8' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#9' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#10' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#11' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#12' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#13' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#14' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 1 -- `msr ssbs,#15' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#2' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#3' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#4' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#5' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#6' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#7' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#8' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#9' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#10' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#11' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#12' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#13' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#14' | ||
[^:]*:[0-9]+: Error: immediate value out of range 0 to 1 at operand 2 -- `msr ssbs,#15' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ func: | |
msr gcr_el1, x3 | ||
|
||
# MSR (immediate) | ||
msr TCO, #8 | ||
msr TCO, #1 | ||
|
||
# Data cache | ||
dc igvac, x1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters