brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.9 KiB · 798bff8 Raw
178 lines · plain
1# RUN: llvm-mc %s -triple=riscv32 -mattr=+c -M no-aliases -show-encoding \2# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s3# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+c < %s \4# RUN:     | llvm-objdump --mattr=+c --no-print-imm-hex -M no-aliases -d -r - \5# RUN:     | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s6# RUN: llvm-mc %s -triple=riscv32 -mattr=+zca -M no-aliases -show-encoding \7# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s8# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+zca < %s \9# RUN:     | llvm-objdump --mattr=+zca --no-print-imm-hex -M no-aliases -d -r - \10# RUN:     | FileCheck --check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s11# RUN: llvm-mc %s -triple=riscv64 -mattr=+c -M no-aliases -show-encoding \12# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s13# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+c < %s \14# RUN:     | llvm-objdump --mattr=+c --no-print-imm-hex -M no-aliases -d -r - \15# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s16# RUN: llvm-mc %s -triple=riscv64 -mattr=+zca -M no-aliases -show-encoding \17# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s18# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+zca < %s \19# RUN:     | llvm-objdump --mattr=+zca --no-print-imm-hex -M no-aliases -d -r - \20# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s21 22# RUN: not llvm-mc -triple riscv32 \23# RUN:     -M no-aliases -show-encoding < %s 2>&1 \24# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s25 26# TODO: more exhaustive testing of immediate encoding.27 28# CHECK-ASM-AND-OBJ: c.lwsp ra, 0(sp)29# CHECK-ASM: encoding: [0x82,0x40]30# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}31c.lwsp ra, 0(sp)32# CHECK-ASM-AND-OBJ: c.swsp ra, 252(sp)33# CHECK-ASM: encoding: [0x86,0xdf]34# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}35c.swsp ra, 252(sp)36# CHECK-ASM-AND-OBJ: c.lw a2, 0(a0)37# CHECK-ASM: encoding: [0x10,0x41]38# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}39c.lw a2, 0(a0)40# CHECK-ASM-AND-OBJ: c.sw a5, 124(a3)41# CHECK-ASM: encoding: [0xfc,0xde]42# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}43c.sw a5, 124(a3)44 45# CHECK-ASM-AND-OBJ: c.lwsp s0, 0(sp)46# CHECK-ASM: encoding: [0x02,0x44]47# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}48c.lwsp x8, (x2)49# CHECK-ASM-AND-OBJ: c.swsp s0, 0(sp)50# CHECK-ASM: encoding: [0x22,0xc0]51# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}52c.swsp x8, (x2)53# CHECK-ASM-AND-OBJ: c.lw s0, 0(s1)54# CHECK-ASM: encoding: [0x80,0x40]55# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}56c.lw x8, (x9)57# CHECK-ASM-AND-OBJ: c.sw s0, 0(s1)58# CHECK-ASM: encoding: [0x80,0xc0]59# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}60c.sw x8, (x9)61 62# CHECK-OBJ: c.j 0xfffff81063# CHECK-ASM: c.j -204864# CHECK-ASM: encoding: [0x01,0xb0]65# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}66c.j -204867# CHECK-ASM-AND-OBJ: c.jr a768# CHECK-ASM: encoding: [0x82,0x88]69# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}70c.jr a771# CHECK-ASM-AND-OBJ: c.jalr a172# CHECK-ASM: encoding: [0x82,0x95]73# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}74c.jalr a175# CHECK-OBJ: c.beqz a3, 0xffffff1676# CHECK-ASM: c.beqz a3, -25677# CHECK-ASM: encoding: [0x81,0xd2]78# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}79c.beqz a3, -25680# CHECK-OBJ: c.bnez a5, 0x11681# CHECK-ASM: c.bnez a5, 25482# CHECK-ASM: encoding: [0xfd,0xef]83# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}84c.bnez a5,  25485 86# CHECK-ASM-AND-OBJ: c.li a7, 3187# CHECK-ASM: encoding: [0xfd,0x48]88# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}89c.li a7, 3190# CHECK-ASM-AND-OBJ: c.addi a3, -3291# CHECK-ASM: encoding: [0x81,0x16]92# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}93c.addi a3, -3294# CHECK-ASM-AND-OBJ: c.addi16sp sp, -51295# CHECK-ASM: encoding: [0x01,0x71]96# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}97c.addi16sp sp, -51298# CHECK-ASM-AND-OBJ: c.addi16sp sp, 49699# CHECK-ASM: encoding: [0x7d,0x61]100# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}101c.addi16sp sp, 496102# CHECK-ASM-AND-OBJ: c.addi4spn a3, sp, 1020103# CHECK-ASM: encoding: [0xf4,0x1f]104# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}105c.addi4spn a3, sp, 1020106# CHECK-ASM-AND-OBJ: c.addi4spn a3, sp, 4107# CHECK-ASM: encoding: [0x54,0x00]108# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}109c.addi4spn a3, sp, 4110# CHECK-ASM-AND-OBJ: c.slli a1, 1111# CHECK-ASM: encoding: [0x86,0x05]112# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}113c.slli a1, 1114# CHECK-ASM-AND-OBJ: c.srli a3, 31115# CHECK-ASM: encoding: [0xfd,0x82]116# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}117c.srli a3, 31118# CHECK-ASM-AND-OBJ: c.srai a4, 2119# CHECK-ASM: encoding: [0x09,0x87]120# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}121c.srai a4, 2122# CHECK-ASM-AND-OBJ: c.andi a5, 15123# CHECK-ASM: encoding: [0xbd,0x8b]124# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}125c.andi a5, 15126# CHECK-ASM-AND-OBJ: c.mv a7, s0127# CHECK-ASM: encoding: [0xa2,0x88]128# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}129c.mv a7, s0130# CHECK-ASM-AND-OBJ: c.and a1, a2131# CHECK-ASM: encoding: [0xf1,0x8d]132# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}133c.and a1, a2134# CHECK-ASM-AND-OBJ: c.or a2, a3135# CHECK-ASM: encoding: [0x55,0x8e]136# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}137c.or a2, a3138# CHECK-ASM-AND-OBJ: c.xor a3, a4139# CHECK-ASM: encoding: [0xb9,0x8e]140# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}141c.xor a3, a4142# CHECK-ASM-AND-OBJ: c.sub a4, a5143# CHECK-ASM: encoding: [0x1d,0x8f]144# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}145c.sub a4, a5146# CHECK-ASM-AND-OBJ: c.nop147# CHECK-ASM: encoding: [0x01,0x00]148# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}149c.nop150# CHECK-ASM-AND-OBJ: c.nop151# CHECK-ASM: encoding: [0x01,0x00]152# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}153c.addi x0, 0154# CHECK-ASM-AND-OBJ: c.ebreak155# CHECK-ASM: encoding: [0x02,0x90]156# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}157c.ebreak158# CHECK-ASM-AND-OBJ: c.lui s0, 1159# CHECK-ASM: encoding: [0x05,0x64]160# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}161c.lui s0, 1162# CHECK-ASM-AND-OBJ: c.lui s0, 31163# CHECK-ASM: encoding: [0x7d,0x64]164# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}165c.lui s0, 31166# CHECK-ASM-AND-OBJ: c.lui s0, 1048544167# CHECK-ASM: encoding: [0x01,0x74]168# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}169c.lui s0, 0xfffe0170# CHECK-ASM-AND-OBJ: c.lui s0, 1048575171# CHECK-ASM: encoding: [0x7d,0x74]172# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}173c.lui s0, 0xfffff174# CHECK-ASM-AND-OBJ: c.unimp175# CHECK-ASM: encoding: [0x00,0x00]176# CHECK-NO-EXT:  error: instruction requires the following: 'C' (Compressed Instructions) or 'Zca' (part of the C extension, excluding compressed floating point loads/stores){{$}}177c.unimp178