llvm-project/llvm/test/MC/Sparc/sparc-asm-errors.s
Koakuma a92bcb20b8
[SPARC][IAS] Reject unknown/unavailable mnemonics early in ParseInstruction
Validate and reject any unknown or unavailable instruction mnemonics early
in ParseInstruction, before any operand parsing is performed. Some operands
(mainly memory ones) can be parsed slightly differently in V8 and V9
assembly language, so by rejecting unknown or unavailable instructions early
we can prevent the error message from being shadowed by the one raised during
operand parsing.

As a side effect this also allows us to tell unknown and unavailable
mnemonics apart, and issue a suggestion in appropriate cases.

This is based on the approach taken by the MIPS backend.

Reviewers: brad0, rorth, s-barannikov, jrtc27

Reviewed By: s-barannikov

Pull Request: https://github.com/llvm/llvm-project/pull/96021
2024-07-11 11:33:19 +07:00

23 lines
866 B
ArmAsm

! RUN: not llvm-mc %s -triple=sparc -show-encoding 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=V8
! RUN: not llvm-mc %s -triple=sparcv9 -show-encoding 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=V9
! Test the lower and upper bounds of 'set'
! CHECK: argument must be between
set -2147483649, %o1
! CHECK: argument must be between
set 4294967296, %o1
! V8: instruction requires a CPU feature not currently enabled
! V9: unknown membar tag
membar #BadTag
! V8: instruction requires a CPU feature not currently enabled
! V9: invalid membar mask number
membar -127
! Test the boundary checks on the shift amount
! V8: immediate shift value out of range
sll %g1, 32, %g2
! V9: immediate shift value out of range
slx %g1, 64, %g2