blob: df589c1274e38978d9626790ac5a8123abb04391 [file] [log] [blame]
Tom Stellard89049702016-06-15 02:54:14 +00001// RUN: llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck %s --check-prefix=VI
2
3
4.globl global
5.globl gds
6
7// Parse a global expression
8s_mov_b32 s0, global
9// VI: s_mov_b32 s0, global ; encoding: [0xff,0x00,0x80,0xbe,A,A,A,A]
10// VI-NEXT: ; fixup A - offset: 4, value: global, kind: FK_PCRel_4
11
12// Use a token with the same name as a global
13ds_gws_init v2 gds
Dmitry Preobrazhenskye5147242017-04-07 13:07:13 +000014// VI: ds_gws_init v2 gds ; encoding: [0x00,0x00,0x33,0xd9,0x00,0x02,0x00,0x00]
Tom Stellard89049702016-06-15 02:54:14 +000015
16// Use a global with the same name as a token
17s_mov_b32 s0, gds
18// VI: s_mov_b32 s0, gds ; encoding: [0xff,0x00,0x80,0xbe,A,A,A,A]
19// VI-NEXT: ; fixup A - offset: 4, value: gds, kind: FK_PCRel_4
20
21// Use a binary expression
22s_mov_b32 s0, gds+4
23// VI: s_mov_b32 s0, gds+4 ; encoding: [0xff,0x00,0x80,0xbe,A,A,A,A]
24// VI-NEXT: ; fixup A - offset: 4, value: gds+4, kind: FK_PCRel_4
25
26// Consecutive instructions with no blank line in between to make sure we
27// don't call Lex() too many times.
28s_add_u32 s0, s0, global+4
29s_addc_u32 s1, s1, 0
30// VI: s_add_u32 s0, s0, global+4
31// VI: s_addc_u32 s1, s1, 0
Tom Stellard82785e92016-06-15 03:09:39 +000032
33// Use a computed expression that results in an inline immediate.
34.set foo, 4
35s_mov_b32 s0, foo+2
36// VI: s_mov_b32 s0, 6 ; encoding: [0x86,0x00,0x80,0xbe]
37
38// Use a computed expression that results in a non-inline immediate.
39.set foo, 512
40s_mov_b32 s0, foo+2
41// VI: s_mov_b32 s0, 514 ; encoding: [0xff,0x00,0x80,0xbe,0x02,0x02,0x00,0x00]
Dmitry Preobrazhensky4b11a782017-08-04 13:55:24 +000042
Dmitry Preobrazhensky32c6b5c2018-06-13 17:02:03 +000043v_mul_f32 v0, foo+2, v2
44// VI: v_mul_f32_e32 v0, 514, v2 ; encoding: [0xff,0x04,0x00,0x0a,0x02,0x02,0x00,0x00]
45
Dmitry Preobrazhensky4b11a782017-08-04 13:55:24 +000046BB1:
47v_nop_e64
48BB2:
49s_sub_u32 vcc_lo, vcc_lo, (BB2+4)-BB1
50// VI: s_sub_u32 vcc_lo, vcc_lo, (BB2+4)-BB1 ; encoding: [0x6a,0xff,0xea,0x80,A,A,A,A]
51// VI-NEXT: ; fixup A - offset: 4, value: (BB2+4)-BB1, kind: FK_Data_4
Dmitry Preobrazhensky471adf72017-12-22 18:03:35 +000052
53t=1
54s_sub_u32 s0, s0, -t
55// VI: s_sub_u32 s0, s0, -1 ; encoding: [0x00,0xc1,0x80,0x80]
56
57t=-1
58s_sub_u32 s0, s0, -t
59// VI: s_sub_u32 s0, s0, 1 ; encoding: [0x00,0x81,0x80,0x80]