[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / MC / AMDGPU / sopc.s
blob3a80307dd5299de8105ab6c3df68e4dad797ef54
1 // RUN: not llvm-mc -arch=amdgcn -mcpu=tahiti -show-encoding %s | FileCheck -check-prefix=GCN %s
2 // RUN: llvm-mc -arch=amdgcn -mcpu=fiji -show-encoding %s | FileCheck --check-prefixes=GCN,VI %s
3 // RUN: not llvm-mc -arch=amdgcn -mcpu=tahiti %s 2>&1 | FileCheck -check-prefix=NOSICI --implicit-check-not=error: %s
4 // RUN: not llvm-mc -arch=amdgcn -mcpu=gfx1010 %s 2>&1 | FileCheck -check-prefix=GFX10-ERR --implicit-check-not=error: %s
6 //===----------------------------------------------------------------------===//
7 // SOPC Instructions
8 //===----------------------------------------------------------------------===//
10 s_cmp_eq_i32 s1, s2
11 // GCN: s_cmp_eq_i32 s1, s2 ; encoding: [0x01,0x02,0x00,0xbf]
13 s_cmp_eq_i32 0xabcd1234, 0xabcd1234
14 // GCN: s_cmp_eq_i32 0xabcd1234, 0xabcd1234 ; encoding: [0xff,0xff,0x00,0xbf,0x34,0x12,0xcd,0xab]
16 s_cmp_eq_i32 0xFFFF0000, -65536
17 // GCN: s_cmp_eq_i32 0xffff0000, 0xffff0000 ; encoding: [0xff,0xff,0x00,0xbf,0x00,0x00,0xff,0xff]
19 s_cmp_lg_i32 s1, s2
20 // GCN: s_cmp_lg_i32 s1, s2 ; encoding: [0x01,0x02,0x01,0xbf]
22 s_cmp_gt_i32 s1, s2
23 // GCN: s_cmp_gt_i32 s1, s2 ; encoding: [0x01,0x02,0x02,0xbf]
25 s_cmp_ge_i32 s1, s2
26 // GCN: s_cmp_ge_i32 s1, s2 ; encoding: [0x01,0x02,0x03,0xbf]
28 s_cmp_lt_i32 s1, s2
29 // GCN: s_cmp_lt_i32 s1, s2 ; encoding: [0x01,0x02,0x04,0xbf]
31 s_cmp_le_i32 s1, s2
32 // GCN: s_cmp_le_i32 s1, s2 ; encoding: [0x01,0x02,0x05,0xbf]
34 s_cmp_eq_u32 s1, s2
35 // GCN: s_cmp_eq_u32 s1, s2 ; encoding: [0x01,0x02,0x06,0xbf]
37 s_cmp_lg_u32 s1, s2
38 // GCN: s_cmp_lg_u32 s1, s2 ; encoding: [0x01,0x02,0x07,0xbf]
40 s_cmp_gt_u32 s1, s2
41 // GCN: s_cmp_gt_u32 s1, s2 ; encoding: [0x01,0x02,0x08,0xbf]
43 s_cmp_ge_u32 s1, s2
44 // GCN: s_cmp_ge_u32 s1, s2 ; encoding: [0x01,0x02,0x09,0xbf]
46 s_cmp_lt_u32 s1, s2
47 // GCN: s_cmp_lt_u32 s1, s2 ; encoding: [0x01,0x02,0x0a,0xbf]
49 s_cmp_le_u32 s1, s2
50 // GCN: s_cmp_le_u32 s1, s2 ; encoding: [0x01,0x02,0x0b,0xbf]
52 s_bitcmp0_b32 s1, s2
53 // GCN: s_bitcmp0_b32 s1, s2 ; encoding: [0x01,0x02,0x0c,0xbf]
55 s_bitcmp1_b32 s1, s2
56 // GCN: s_bitcmp1_b32 s1, s2 ; encoding: [0x01,0x02,0x0d,0xbf]
58 s_bitcmp0_b64 s[2:3], s4
59 // GCN: s_bitcmp0_b64 s[2:3], s4 ; encoding: [0x02,0x04,0x0e,0xbf]
61 s_bitcmp1_b64 s[2:3], s4
62 // GCN: s_bitcmp1_b64 s[2:3], s4 ; encoding: [0x02,0x04,0x0f,0xbf]
64 s_setvskip s3, s5
65 // GCN: s_setvskip s3, s5 ; encoding: [0x03,0x05,0x10,0xbf]
66 // GFX10-ERR: error: instruction not supported on this GPU
68 s_cmp_eq_u64 s[0:1], s[2:3]
69 // VI: s_cmp_eq_u64 s[0:1], s[2:3] ; encoding: [0x00,0x02,0x12,0xbf]
70 // NOSICI: error: instruction not supported on this GPU
72 s_cmp_lg_u64 s[0:1], s[2:3]
73 // VI: s_cmp_lg_u64 s[0:1], s[2:3] ; encoding: [0x00,0x02,0x13,0xbf]
74 // NOSICI: error: instruction not supported on this GPU
76 gpr_idx = 1
77 s_set_gpr_idx_on s0, gpr_idx
78 // VI: s_set_gpr_idx_on s0, gpr_idx(SRC0) ; encoding: [0x00,0x01,0x11,0xbf]
79 // NOSICI: error: instruction not supported on this GPU
80 // GFX10-ERR: error: instruction not supported on this GPU
82 gpr_idx_mode = 10
83 s_set_gpr_idx_on s0, gpr_idx_mode + 5
84 // VI: s_set_gpr_idx_on s0, gpr_idx(SRC0,SRC1,SRC2,DST) ; encoding: [0x00,0x0f,0x11,0xbf]
85 // NOSICI: error: instruction not supported on this GPU
86 // GFX10-ERR: error: instruction not supported on this GPU
88 s_set_gpr_idx_on s0, 0
89 // VI: s_set_gpr_idx_on s0, gpr_idx() ; encoding: [0x00,0x00,0x11,0xbf]
90 // NOSICI: error: instruction not supported on this GPU
91 // GFX10-ERR: error: instruction not supported on this GPU
93 s_set_gpr_idx_on s0, gpr_idx()
94 // VI: s_set_gpr_idx_on s0, gpr_idx() ; encoding: [0x00,0x00,0x11,0xbf]
95 // NOSICI: error: instruction not supported on this GPU
96 // GFX10-ERR: error: instruction not supported on this GPU
98 s_set_gpr_idx_on s0, 1
99 // VI: s_set_gpr_idx_on s0, gpr_idx(SRC0) ; encoding: [0x00,0x01,0x11,0xbf]
100 // NOSICI: error: instruction not supported on this GPU
101 // GFX10-ERR: error: instruction not supported on this GPU
103 s_set_gpr_idx_on s0, gpr_idx(SRC0)
104 // VI: s_set_gpr_idx_on s0, gpr_idx(SRC0) ; encoding: [0x00,0x01,0x11,0xbf]
105 // NOSICI: error: instruction not supported on this GPU
106 // GFX10-ERR: error: instruction not supported on this GPU
108 s_set_gpr_idx_on s0, 3
109 // VI: s_set_gpr_idx_on s0, gpr_idx(SRC0,SRC1) ; encoding: [0x00,0x03,0x11,0xbf]
110 // NOSICI: error: instruction not supported on this GPU
111 // GFX10-ERR: error: instruction not supported on this GPU
113 s_set_gpr_idx_on s0, gpr_idx(SRC1,SRC0)
114 // VI: s_set_gpr_idx_on s0, gpr_idx(SRC0,SRC1) ; encoding: [0x00,0x03,0x11,0xbf]
115 // NOSICI: error: instruction not supported on this GPU
116 // GFX10-ERR: error: instruction not supported on this GPU
118 s_set_gpr_idx_on s0, 15
119 // VI: s_set_gpr_idx_on s0, gpr_idx(SRC0,SRC1,SRC2,DST) ; encoding: [0x00,0x0f,0x11,0xbf]
120 // NOSICI: error: instruction not supported on this GPU
121 // GFX10-ERR: error: instruction not supported on this GPU
123 s_set_gpr_idx_on s0, gpr_idx(SRC0,DST,SRC2,SRC1)
124 // VI: s_set_gpr_idx_on s0, gpr_idx(SRC0,SRC1,SRC2,DST) ; encoding: [0x00,0x0f,0x11,0xbf]
125 // NOSICI: error: instruction not supported on this GPU
126 // GFX10-ERR: error: instruction not supported on this GPU