xref: /llvm-project/llvm/test/MC/RISCV/rvzabha-zacas-valid.s (revision 4b3d439e7e7b4e794e523caea9863d67ff8cf85f)
1# RUN: llvm-mc %s -triple=riscv32 -mattr=+a,+zabha,+zacas -M no-aliases -show-encoding \
2# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
3# RUN: llvm-mc %s -triple=riscv64 -mattr=+a,+zabha,+zacas -M no-aliases -show-encoding \
4# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
5# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+a,+zabha,+zacas < %s \
6# RUN:     | llvm-objdump --mattr=+a,+zabha,+zacas -M no-aliases -d -r - \
7# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
8# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a,+zabha,+zacas < %s \
9# RUN:     | llvm-objdump --mattr=+a,+zabha,+zacas -M no-aliases -d -r - \
10# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
11# RUN: not llvm-mc -triple=riscv32 -mattr=+a,+zabha -show-encoding %s 2>&1 \
12# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
13# RUN: not llvm-mc -triple=riscv64 -mattr=+a,+zabha -show-encoding %s 2>&1 \
14# RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
15
16# CHECK-ASM-AND-OBJ: amocas.b a1, a3, (a5)
17# CHECK-ASM: encoding: [0xaf,0x85,0xd7,0x28]
18# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
19amocas.b a1, a3, (a5)
20# CHECK-ASM-AND-OBJ: amocas.b a1, a3, (a5)
21# CHECK-ASM: encoding: [0xaf,0x85,0xd7,0x28]
22# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
23amocas.b a1, a3, 0(a5)
24# CHECK-ASM-AND-OBJ: amocas.b zero, zero, (a5)
25# CHECK-ASM: encoding: [0x2f,0x80,0x07,0x28]
26# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
27amocas.b zero, zero, (a5)
28# CHECK-ASM-AND-OBJ: amocas.b.aq zero, zero, (a5)
29# CHECK-ASM: encoding: [0x2f,0x80,0x07,0x2c]
30# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
31amocas.b.aq zero, zero, (a5)
32# CHECK-ASM-AND-OBJ: amocas.b.rl zero, zero, (a5)
33# CHECK-ASM: encoding: [0x2f,0x80,0x07,0x2a]
34# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
35amocas.b.rl zero, zero, (a5)
36# CHECK-ASM-AND-OBJ: amocas.b.aqrl zero, zero, (a5)
37# CHECK-ASM: encoding: [0x2f,0x80,0x07,0x2e]
38# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
39amocas.b.aqrl zero, zero, (a5)
40
41# CHECK-ASM-AND-OBJ: amocas.h a0, a2, (a1)
42# CHECK-ASM: encoding: [0x2f,0x95,0xc5,0x28]
43# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
44amocas.h a0, a2, (a1)
45# CHECK-ASM-AND-OBJ: amocas.h a0, a2, (a1)
46# CHECK-ASM: encoding: [0x2f,0x95,0xc5,0x28]
47# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
48amocas.h a0, a2, 0(a1)
49# CHECK-ASM-AND-OBJ: amocas.h zero, zero, (a1)
50# CHECK-ASM: encoding: [0x2f,0x90,0x05,0x28]
51# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
52amocas.h zero, zero, (a1)
53# CHECK-ASM-AND-OBJ: amocas.h.aq zero, zero, (a1)
54# CHECK-ASM: encoding: [0x2f,0x90,0x05,0x2c]
55# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
56amocas.h.aq zero, zero, (a1)
57# CHECK-ASM-AND-OBJ: amocas.h.rl zero, zero, (a1)
58# CHECK-ASM: encoding: [0x2f,0x90,0x05,0x2a]
59# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
60amocas.h.rl zero, zero, (a1)
61# CHECK-ASM-AND-OBJ: amocas.h.aqrl zero, zero, (a1)
62# CHECK-ASM: encoding: [0x2f,0x90,0x05,0x2e]
63# CHECK-ERROR: instruction requires the following: 'Zacas' (Atomic Compare-And-Swap Instructions){{$}}
64amocas.h.aqrl zero, zero, (a1)
65