Skip to content

Commit 4ac589d

Browse files
committed
Add new SIMDLoadStoreLane
1 parent 8de6c45 commit 4ac589d

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

scripts/gen-exprs.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ class SIMDLoadOp(Field):
187187
"""A SIMD load opcode."""
188188

189189

190+
class SIMDLoadStoreLaneOp(Field):
191+
"""A SIMD Load/Store Lane opcode."""
192+
193+
190194
class Expression:
191195
"""Core class from which all expressions inherit."""
192196

@@ -446,6 +450,22 @@ class SIMDLoad(Expression):
446450
methods = ['Index getMemBytes();']
447451

448452

453+
class SIMDLoadStoreLane(Expression):
454+
op = SIMDLoadStoreLaneOp()
455+
offset = Address()
456+
align = Address()
457+
index = uint8_t()
458+
ptr = Child()
459+
vec = Child()
460+
461+
methods = [
462+
'bool isStore();',
463+
'bool isLoad() { return !isStore(); }',
464+
'Index getMemBytes();',
465+
'void finalize();'
466+
]
467+
468+
449469
class MemoryInit(Expression):
450470
segment = Index()
451471
dest = Child()

src/ir/compare-expressions.generated.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,27 @@ case Expression::SIMDLoadId: {
377377
rightStack.push_back(castRight->ptr);
378378
break;
379379
}
380+
case Expression::SIMDLoadStoreLaneId: {
381+
auto* castLeft = left->cast<SIMDLoadStoreLane>();
382+
auto* castRight = right->cast<SIMDLoadStoreLane>();
383+
if (castLeft->op != castRight->op) {
384+
return false;
385+
}
386+
if (castLeft->offset != castRight->offset) {
387+
return false;
388+
}
389+
if (castLeft->align != castRight->align) {
390+
return false;
391+
}
392+
if (castLeft->index != castRight->index) {
393+
return false;
394+
}
395+
leftStack.push_back(castLeft->ptr);
396+
rightStack.push_back(castRight->ptr);
397+
leftStack.push_back(castLeft->vec);
398+
rightStack.push_back(castRight->vec);
399+
break;
400+
}
380401
case Expression::MemoryInitId: {
381402
auto* castLeft = left->cast<MemoryInit>();
382403
auto* castRight = right->cast<MemoryInit>();

src/wasm-expressions.generated.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,22 @@ class SIMDLoad : public SpecificExpression<Expression::SIMDLoadId> {
258258
Index getMemBytes();
259259
void finalize();
260260
};
261+
class SIMDLoadStoreLane
262+
: public SpecificExpression<Expression::SIMDLoadStoreLaneId> {
263+
public:
264+
SIMDLoadStoreLane() {}
265+
SIMDLoadStoreLane(MixedArena& allocator) : SIMDLoadStoreLane() {}
266+
SIMDLoadStoreLaneOp op;
267+
Address offset;
268+
Address align;
269+
uint8_t index;
270+
Expression* ptr;
271+
Expression* vec;
272+
bool isStore();
273+
bool isLoad() { return !isStore(); }
274+
Index getMemBytes();
275+
void finalize();
276+
};
261277
class MemoryInit : public SpecificExpression<Expression::MemoryInitId> {
262278
public:
263279
MemoryInit() {}

0 commit comments

Comments
 (0)