R600 -> AMDGPU rename
[oota-llvm.git] / test / MC / AMDGPU / vop3.s
1 // RUN: llvm-mc -arch=amdgcn -show-encoding %s | FileCheck %s
2 // RUN: llvm-mc -arch=amdgcn -mcpu=SI -show-encoding %s | FileCheck %s
3
4 //===----------------------------------------------------------------------===//
5 // VOPC Instructions
6 //===----------------------------------------------------------------------===//
7
8 // Test forced e64 encoding
9
10 v_cmp_lt_f32_e64 s[2:3], v4, -v6
11 // CHECK: v_cmp_lt_f32_e64 s[2:3], v4, -v6 ; encoding: [0x02,0x00,0x02,0xd0,0x04,0x0d,0x02,0x40]
12
13 //
14 // Modifier tests:
15 //
16
17 v_cmp_lt_f32 s[2:3] -v4, v6
18 // CHECK: v_cmp_lt_f32_e64 s[2:3], -v4, v6 ; encoding: [0x02,0x00,0x02,0xd0,0x04,0x0d,0x02,0x20] 
19
20 v_cmp_lt_f32 s[2:3]  v4, -v6
21 // CHECK: v_cmp_lt_f32_e64 s[2:3], v4, -v6 ; encoding: [0x02,0x00,0x02,0xd0,0x04,0x0d,0x02,0x40]
22
23 v_cmp_lt_f32 s[2:3] -v4, -v6
24 // CHECK: v_cmp_lt_f32_e64 s[2:3], -v4, -v6 ; encoding: [0x02,0x00,0x02,0xd0,0x04,0x0d,0x02,0x60]
25
26 v_cmp_lt_f32 s[2:3] |v4|, v6
27 // CHECK: v_cmp_lt_f32_e64 s[2:3], |v4|, v6 ; encoding: [0x02,0x01,0x02,0xd0,0x04,0x0d,0x02,0x00]
28
29 v_cmp_lt_f32 s[2:3] v4, |v6|
30 // CHECK: v_cmp_lt_f32_e64 s[2:3], v4, |v6| ; encoding: [0x02,0x02,0x02,0xd0,0x04,0x0d,0x02,0x00]
31
32 v_cmp_lt_f32 s[2:3] |v4|, |v6|
33 // CHECK: v_cmp_lt_f32_e64 s[2:3], |v4|, |v6| ; encoding: [0x02,0x03,0x02,0xd0,0x04,0x0d,0x02,0x00]
34
35 v_cmp_lt_f32 s[2:3] -|v4|, v6
36 // CHECK: v_cmp_lt_f32_e64 s[2:3], -|v4|, v6 ; encoding: [0x02,0x01,0x02,0xd0,0x04,0x0d,0x02,0x20]
37
38 v_cmp_lt_f32 s[2:3] v4, -|v6|
39 // CHECK: v_cmp_lt_f32_e64 s[2:3], v4, -|v6| ; encoding: [0x02,0x02,0x02,0xd0,0x04,0x0d,0x02,0x40]
40
41 v_cmp_lt_f32 s[2:3] -|v4|, -|v6|
42 // CHECK: v_cmp_lt_f32_e64 s[2:3], -|v4|, -|v6| ; encoding: [0x02,0x03,0x02,0xd0,0x04,0x0d,0x02,0x60]
43
44 //
45 // Instruction tests:
46 //
47
48 v_cmp_f_f32 s[2:3], v4, v6
49 // CHECK: v_cmp_f_f32_e64 s[2:3], v4, v6 ; encoding: [0x02,0x00,0x00,0xd0,0x04,0x0d,0x02,0x00]
50
51 v_cmp_lt_f32 s[2:3], v4, v6
52 // CHECK: v_cmp_lt_f32_e64 s[2:3], v4, v6 ; encoding: [0x02,0x00,0x02,0xd0,0x04,0x0d,0x02,0x00]
53
54 v_cmp_eq_f32 s[2:3], v4, v6
55 // CHECK: v_cmp_eq_f32_e64 s[2:3], v4, v6 ; encoding: [0x02,0x00,0x04,0xd0,0x04,0x0d,0x02,0x00]
56
57 v_cmp_le_f32 s[2:3], v4, v6
58 // CHECK: v_cmp_le_f32_e64 s[2:3], v4, v6 ; encoding: [0x02,0x00,0x06,0xd0,0x04,0x0d,0x02,0x00]
59
60 v_cmp_gt_f32 s[2:3], v4, v6
61 // CHECK: v_cmp_gt_f32_e64 s[2:3], v4, v6 ; encoding: [0x02,0x00,0x08,0xd0,0x04,0x0d,0x02,0x00]
62
63 v_cmp_lg_f32 s[2:3], v4, v6
64 // CHECK: v_cmp_lg_f32_e64 s[2:3], v4, v6 ; encoding: [0x02,0x00,0x0a,0xd0,0x04,0x0d,0x02,0x00]
65
66 v_cmp_ge_f32 s[2:3], v4, v6
67 // CHECK: v_cmp_ge_f32_e64 s[2:3], v4, v6 ; encoding: [0x02,0x00,0x0c,0xd0,0x04,0x0d,0x02,0x00]
68
69 // TODO: Finish VOPC
70
71 //===----------------------------------------------------------------------===//
72 // VOP1 Instructions
73 //===----------------------------------------------------------------------===//
74
75 //
76 // Modifier tests:
77 // 
78
79 v_fract_f32 v1, -v2
80 // CHECK: v_fract_f32_e64 v1, -v2 ; encoding: [0x01,0x00,0x40,0xd3,0x02,0x01,0x00,0x20]
81
82 v_fract_f32 v1, |v2|
83 // CHECK: v_fract_f32_e64 v1, |v2| ; encoding: [0x01,0x01,0x40,0xd3,0x02,0x01,0x00,0x00]
84
85 v_fract_f32 v1, -|v2|
86 // CHECK: v_fract_f32_e64 v1, -|v2| ; encoding: [0x01,0x01,0x40,0xd3,0x02,0x01,0x00,0x20]
87
88 v_fract_f32 v1, v2 clamp
89 // CHECK: v_fract_f32_e64 v1, v2 clamp ; encoding: [0x01,0x08,0x40,0xd3,0x02,0x01,0x00,0x00]
90
91 v_fract_f32 v1, v2 mul:2
92 // CHECK: v_fract_f32_e64 v1, v2 mul:2 ; encoding: [0x01,0x00,0x40,0xd3,0x02,0x01,0x00,0x08]
93
94 v_fract_f32 v1, v2, div:2 clamp
95 // CHECK: v_fract_f32_e64 v1, v2 clamp div:2 ; encoding: [0x01,0x08,0x40,0xd3,0x02,0x01,0x00,0x18]
96
97 // TODO: Finish VOP1
98
99 ///===---------------------------------------------------------------------===//
100 // VOP2 Instructions
101 ///===---------------------------------------------------------------------===//
102
103 // Test forced e64 encoding with e32 operands
104
105 v_ldexp_f32_e64 v1, v3, v5
106 // CHECK: v_ldexp_f32_e64 v1, v3, v5 ; encoding: [0x01,0x00,0x56,0xd2,0x03,0x0b,0x02,0x00]
107
108
109 // TODO: Modifier tests
110
111 v_cndmask_b32 v1, v3, v5, s[4:5]
112 // CHECK: v_cndmask_b32_e64 v1, v3, v5, s[4:5] ; encoding: [0x01,0x00,0x00,0xd2,0x03,0x0b,0x12,0x00]
113
114 //TODO: readlane, writelane
115
116 v_add_f32 v1, v3, s5
117 // CHECK: v_add_f32_e64 v1, v3, s5 ; encoding: [0x01,0x00,0x06,0xd2,0x03,0x0b,0x00,0x00]
118
119 v_sub_f32 v1, v3, s5
120 // CHECK: v_sub_f32_e64 v1, v3, s5 ; encoding: [0x01,0x00,0x08,0xd2,0x03,0x0b,0x00,0x00]
121
122 v_subrev_f32 v1, v3, s5
123 // CHECK: v_subrev_f32_e64 v1, v3, s5 ; encoding: [0x01,0x00,0x0a,0xd2,0x03,0x0b,0x00,0x00]
124
125 v_mac_legacy_f32 v1, v3, s5
126 // CHECK: v_mac_legacy_f32_e64 v1, v3, s5 ; encoding: [0x01,0x00,0x0c,0xd2,0x03,0x0b,0x00,0x00]
127
128 v_mul_legacy_f32 v1, v3, s5
129 // CHECK: v_mul_legacy_f32_e64 v1, v3, s5 ; encoding: [0x01,0x00,0x0e,0xd2,0x03,0x0b,0x00,0x00]
130
131 v_mul_f32 v1, v3, s5
132 // CHECK: v_mul_f32_e64 v1, v3, s5 ; encoding: [0x01,0x00,0x10,0xd2,0x03,0x0b,0x00,0x00]
133
134 v_mul_i32_i24 v1, v3, s5
135 // CHECK: v_mul_i32_i24_e64 v1, v3, s5 ; encoding: [0x01,0x00,0x12,0xd2,0x03,0x0b,0x00,0x00]
136
137 ///===---------------------------------------------------------------------===//
138 // VOP3 Instructions
139 ///===---------------------------------------------------------------------===//
140
141 // TODO: Modifier tests
142
143 v_mad_legacy_f32 v2, v4, v6, v8
144 // CHECK: v_mad_legacy_f32 v2, v4, v6, v8 ; encoding: [0x02,0x00,0x80,0xd2,0x04,0x0d,0x22,0x04]
145
146
147
148
149