@@ -33,96 +33,98 @@ multiclass ATOMIC_NRI<dag oops, dag iops, list<dag> pattern, string asmstr = "",
3333//===----------------------------------------------------------------------===//
3434
3535let hasSideEffects = 1 in {
36- defm ATOMIC_NOTIFY_A32 :
36+ defm MEMORY_ATOMIC_NOTIFY_A32 :
3737 ATOMIC_I<(outs I32:$dst),
3838 (ins P2Align:$p2align, offset32_op:$off, I32:$addr, I32:$count),
3939 (outs), (ins P2Align:$p2align, offset32_op:$off), [],
40- "atomic.notify \t$dst, ${off}(${addr})${p2align}, $count",
41- "atomic.notify \t${off}${p2align}", 0x00, "false">;
42- defm ATOMIC_NOTIFY_A64 :
40+ "memory. atomic.notify \t$dst, ${off}(${addr})${p2align}, $count",
41+ "memory. atomic.notify \t${off}${p2align}", 0x00, "false">;
42+ defm MEMORY_ATOMIC_NOTIFY_A64 :
4343 ATOMIC_I<(outs I32:$dst),
4444 (ins P2Align:$p2align, offset64_op:$off, I64:$addr, I32:$count),
4545 (outs), (ins P2Align:$p2align, offset64_op:$off), [],
46- "atomic.notify \t$dst, ${off}(${addr})${p2align}, $count",
47- "atomic.notify \t${off}${p2align}", 0x00, "true">;
46+ "memory. atomic.notify \t$dst, ${off}(${addr})${p2align}, $count",
47+ "memory. atomic.notify \t${off}${p2align}", 0x00, "true">;
4848let mayLoad = 1 in {
49- defm ATOMIC_WAIT_I32_A32 :
49+ defm MEMORY_ATOMIC_WAIT32_A32 :
5050 ATOMIC_I<(outs I32:$dst),
5151 (ins P2Align:$p2align, offset32_op:$off, I32:$addr, I32:$exp,
5252 I64:$timeout),
5353 (outs), (ins P2Align:$p2align, offset32_op:$off), [],
54- "i32 .atomic.wait \t$dst, ${off}(${addr})${p2align}, $exp, $timeout",
55- "i32 .atomic.wait \t${off}${p2align}", 0x01, "false">;
56- defm ATOMIC_WAIT_I32_A64 :
54+ "memory .atomic.wait32 \t$dst, ${off}(${addr})${p2align}, $exp, $timeout",
55+ "memory .atomic.wait32 \t${off}${p2align}", 0x01, "false">;
56+ defm MEMORY_ATOMIC_WAIT32_A64 :
5757 ATOMIC_I<(outs I32:$dst),
5858 (ins P2Align:$p2align, offset64_op:$off, I64:$addr, I32:$exp,
5959 I64:$timeout),
6060 (outs), (ins P2Align:$p2align, offset64_op:$off), [],
61- "i32 .atomic.wait \t$dst, ${off}(${addr})${p2align}, $exp, $timeout",
62- "i32 .atomic.wait \t${off}${p2align}", 0x01, "true">;
63- defm ATOMIC_WAIT_I64_A32 :
61+ "memory .atomic.wait32 \t$dst, ${off}(${addr})${p2align}, $exp, $timeout",
62+ "memory .atomic.wait32 \t${off}${p2align}", 0x01, "true">;
63+ defm MEMORY_ATOMIC_WAIT64_A32 :
6464 ATOMIC_I<(outs I32:$dst),
6565 (ins P2Align:$p2align, offset32_op:$off, I32:$addr, I64:$exp,
6666 I64:$timeout),
6767 (outs), (ins P2Align:$p2align, offset32_op:$off), [],
68- "i64 .atomic.wait \t$dst, ${off}(${addr})${p2align}, $exp, $timeout",
69- "i64 .atomic.wait \t${off}${p2align}", 0x02, "false">;
70- defm ATOMIC_WAIT_I64_A64 :
68+ "memory .atomic.wait64 \t$dst, ${off}(${addr})${p2align}, $exp, $timeout",
69+ "memory .atomic.wait64 \t${off}${p2align}", 0x02, "false">;
70+ defm MEMORY_ATOMIC_WAIT64_A64 :
7171 ATOMIC_I<(outs I32:$dst),
7272 (ins P2Align:$p2align, offset64_op:$off, I64:$addr, I64:$exp,
7373 I64:$timeout),
7474 (outs), (ins P2Align:$p2align, offset64_op:$off), [],
75- "i64 .atomic.wait \t$dst, ${off}(${addr})${p2align}, $exp, $timeout",
76- "i64 .atomic.wait \t${off}${p2align}", 0x02, "true">;
75+ "memory .atomic.wait64 \t$dst, ${off}(${addr})${p2align}, $exp, $timeout",
76+ "memory .atomic.wait64 \t${off}${p2align}", 0x02, "true">;
7777} // mayLoad = 1
7878} // hasSideEffects = 1
7979
8080let Predicates = [HasAtomics] in {
8181// Select notifys with no constant offset.
8282def NotifyPatNoOffset_A32 :
83- Pat<(i32 (int_wasm_atomic_notify I32:$addr, I32:$count)),
84- (ATOMIC_NOTIFY_A32 0, 0, I32:$addr, I32:$count)>,
83+ Pat<(i32 (int_wasm_memory_atomic_notify I32:$addr, I32:$count)),
84+ (MEMORY_ATOMIC_NOTIFY_A32 0, 0, I32:$addr, I32:$count)>,
8585 Requires<[HasAddr32]>;
8686def NotifyPatNoOffset_A64 :
87- Pat<(i32 (int_wasm_atomic_notify I64:$addr, I32:$count)),
88- (ATOMIC_NOTIFY_A64 0, 0, I64:$addr, I32:$count)>,
87+ Pat<(i32 (int_wasm_memory_atomic_notify I64:$addr, I32:$count)),
88+ (MEMORY_ATOMIC_NOTIFY_A64 0, 0, I64:$addr, I32:$count)>,
8989 Requires<[HasAddr64]>;
9090
9191// Select notifys with a constant offset.
9292
9393// Pattern with address + immediate offset
9494multiclass NotifyPatImmOff<PatFrag operand, string inst> {
95- def : Pat<(i32 (int_wasm_atomic_notify (operand I32:$addr, imm:$off),
95+ def : Pat<(i32 (int_wasm_memory_atomic_notify (operand I32:$addr, imm:$off),
9696 I32:$count)),
9797 (!cast<NI>(inst#_A32) 0, imm:$off, I32:$addr, I32:$count)>,
9898 Requires<[HasAddr32]>;
99- def : Pat<(i32 (int_wasm_atomic_notify (operand I64:$addr, imm:$off),
99+ def : Pat<(i32 (int_wasm_memory_atomic_notify (operand I64:$addr, imm:$off),
100100 I32:$count)),
101101 (!cast<NI>(inst#_A64) 0, imm:$off, I64:$addr, I32:$count)>,
102102 Requires<[HasAddr64]>;
103103}
104- defm : NotifyPatImmOff<regPlusImm, "ATOMIC_NOTIFY ">;
105- defm : NotifyPatImmOff<or_is_add, "ATOMIC_NOTIFY ">;
104+ defm : NotifyPatImmOff<regPlusImm, "MEMORY_ATOMIC_NOTIFY ">;
105+ defm : NotifyPatImmOff<or_is_add, "MEMORY_ATOMIC_NOTIFY ">;
106106
107107// Select notifys with just a constant offset.
108108def NotifyPatOffsetOnly_A32 :
109- Pat<(i32 (int_wasm_atomic_notify imm:$off, I32:$count)),
110- (ATOMIC_NOTIFY_A32 0, imm:$off, (CONST_I32 0), I32:$count)>,
109+ Pat<(i32 (int_wasm_memory_atomic_notify imm:$off, I32:$count)),
110+ (MEMORY_ATOMIC_NOTIFY_A32 0, imm:$off, (CONST_I32 0), I32:$count)>,
111111 Requires<[HasAddr32]>;
112112def NotifyPatOffsetOnly_A64 :
113- Pat<(i32 (int_wasm_atomic_notify imm:$off, I32:$count)),
114- (ATOMIC_NOTIFY_A64 0, imm:$off, (CONST_I64 0), I32:$count)>,
113+ Pat<(i32 (int_wasm_memory_atomic_notify imm:$off, I32:$count)),
114+ (MEMORY_ATOMIC_NOTIFY_A64 0, imm:$off, (CONST_I64 0), I32:$count)>,
115115 Requires<[HasAddr64]>;
116116
117117def NotifyPatGlobalAddrOffOnly_A32 :
118- Pat<(i32 (int_wasm_atomic_notify (WebAssemblywrapper tglobaladdr:$off),
119- I32:$count)),
120- (ATOMIC_NOTIFY_A32 0, tglobaladdr:$off, (CONST_I32 0), I32:$count)>,
118+ Pat<(i32 (int_wasm_memory_atomic_notify (WebAssemblywrapper tglobaladdr:$off),
119+ I32:$count)),
120+ (MEMORY_ATOMIC_NOTIFY_A32 0, tglobaladdr:$off, (CONST_I32 0), I32:$count)
121+ >,
121122 Requires<[HasAddr32]>;
122123def NotifyPatGlobalAddrOffOnly_A64 :
123- Pat<(i32 (int_wasm_atomic_notify (WebAssemblywrapper tglobaladdr:$off),
124- I32:$count)),
125- (ATOMIC_NOTIFY_A64 0, tglobaladdr:$off, (CONST_I64 0), I32:$count)>,
124+ Pat<(i32 (int_wasm_memory_atomic_notify (WebAssemblywrapper tglobaladdr:$off),
125+ I32:$count)),
126+ (MEMORY_ATOMIC_NOTIFY_A64 0, tglobaladdr:$off, (CONST_I64 0), I32:$count)
127+ >,
126128 Requires<[HasAddr64]>;
127129
128130// Select waits with no constant offset.
@@ -135,10 +137,14 @@ multiclass WaitPatNoOffset<ValueType ty, Intrinsic kind,
135137 (!cast<NI>(inst#_A64) 0, 0, I64:$addr, ty:$exp, I64:$timeout)>,
136138 Requires<[HasAddr64]>;
137139}
138- defm : WaitPatNoOffset<i32, int_wasm_atomic_wait_i32, "ATOMIC_WAIT_I32">;
139- defm : WaitPatNoOffset<i64, int_wasm_atomic_wait_i64, "ATOMIC_WAIT_I64">;
140- defm : WaitPatNoOffset<i32, int_wasm_atomic_wait_i32, "ATOMIC_WAIT_I32">;
141- defm : WaitPatNoOffset<i64, int_wasm_atomic_wait_i64, "ATOMIC_WAIT_I64">;
140+ defm : WaitPatNoOffset<i32, int_wasm_memory_atomic_wait32,
141+ "MEMORY_ATOMIC_WAIT32">;
142+ defm : WaitPatNoOffset<i64, int_wasm_memory_atomic_wait64,
143+ "MEMORY_ATOMIC_WAIT64">;
144+ defm : WaitPatNoOffset<i32, int_wasm_memory_atomic_wait32,
145+ "MEMORY_ATOMIC_WAIT32">;
146+ defm : WaitPatNoOffset<i64, int_wasm_memory_atomic_wait64,
147+ "MEMORY_ATOMIC_WAIT64">;
142148
143149// Select waits with a constant offset.
144150
@@ -154,16 +160,16 @@ multiclass WaitPatImmOff<ValueType ty, Intrinsic kind, PatFrag operand,
154160 I64:$timeout)>,
155161 Requires<[HasAddr64]>;
156162}
157- defm : WaitPatImmOff<i32, int_wasm_atomic_wait_i32 , regPlusImm,
158- "ATOMIC_WAIT_I32 ">;
159- defm : WaitPatImmOff<i32, int_wasm_atomic_wait_i32 , or_is_add,
160- "ATOMIC_WAIT_I32 ">;
161- defm : WaitPatImmOff<i64, int_wasm_atomic_wait_i64 , regPlusImm,
162- "ATOMIC_WAIT_I64 ">;
163- defm : WaitPatImmOff<i64, int_wasm_atomic_wait_i64 , or_is_add,
164- "ATOMIC_WAIT_I64 ">;
165-
166- // Select wait_i32, "ATOMIC_WAIT_I32s with just a constant offset.
163+ defm : WaitPatImmOff<i32, int_wasm_memory_atomic_wait32 , regPlusImm,
164+ "MEMORY_ATOMIC_WAIT32 ">;
165+ defm : WaitPatImmOff<i32, int_wasm_memory_atomic_wait32 , or_is_add,
166+ "MEMORY_ATOMIC_WAIT32 ">;
167+ defm : WaitPatImmOff<i64, int_wasm_memory_atomic_wait64 , regPlusImm,
168+ "MEMORY_ATOMIC_WAIT64 ">;
169+ defm : WaitPatImmOff<i64, int_wasm_memory_atomic_wait64 , or_is_add,
170+ "MEMORY_ATOMIC_WAIT64 ">;
171+
172+ // Select waits with just a constant offset.
167173multiclass WaitPatOffsetOnly<ValueType ty, Intrinsic kind, string inst> {
168174 def : Pat<(i32 (kind imm:$off, ty:$exp, I64:$timeout)),
169175 (!cast<NI>(inst#_A32) 0, imm:$off, (CONST_I32 0), ty:$exp,
@@ -174,8 +180,10 @@ multiclass WaitPatOffsetOnly<ValueType ty, Intrinsic kind, string inst> {
174180 I64:$timeout)>,
175181 Requires<[HasAddr64]>;
176182}
177- defm : WaitPatOffsetOnly<i32, int_wasm_atomic_wait_i32, "ATOMIC_WAIT_I32">;
178- defm : WaitPatOffsetOnly<i64, int_wasm_atomic_wait_i64, "ATOMIC_WAIT_I64">;
183+ defm : WaitPatOffsetOnly<i32, int_wasm_memory_atomic_wait32,
184+ "MEMORY_ATOMIC_WAIT32">;
185+ defm : WaitPatOffsetOnly<i64, int_wasm_memory_atomic_wait64,
186+ "MEMORY_ATOMIC_WAIT64">;
179187
180188multiclass WaitPatGlobalAddrOffOnly<ValueType ty, Intrinsic kind, string inst> {
181189 def : Pat<(i32 (kind (WebAssemblywrapper tglobaladdr:$off), ty:$exp,
@@ -189,10 +197,10 @@ multiclass WaitPatGlobalAddrOffOnly<ValueType ty, Intrinsic kind, string inst> {
189197 I64:$timeout)>,
190198 Requires<[HasAddr64]>;
191199}
192- defm : WaitPatGlobalAddrOffOnly<i32, int_wasm_atomic_wait_i32 ,
193- "ATOMIC_WAIT_I32 ">;
194- defm : WaitPatGlobalAddrOffOnly<i64, int_wasm_atomic_wait_i64 ,
195- "ATOMIC_WAIT_I64 ">;
200+ defm : WaitPatGlobalAddrOffOnly<i32, int_wasm_memory_atomic_wait32 ,
201+ "MEMORY_ATOMIC_WAIT32 ">;
202+ defm : WaitPatGlobalAddrOffOnly<i64, int_wasm_memory_atomic_wait64 ,
203+ "MEMORY_ATOMIC_WAIT64 ">;
196204} // Predicates = [HasAtomics]
197205
198206//===----------------------------------------------------------------------===//
0 commit comments