Skip to content

Commit

Permalink
Add OpUMod
Browse files Browse the repository at this point in the history
  • Loading branch information
natgavrilenko authored and hernanponcedeleon committed Nov 16, 2024
1 parent 4fc81b1 commit 6322d95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public Event visitOpSDiv(SpirvParser.OpSDivContext ctx) {
return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), DIV);
}

@Override
public Event visitOpUMod(SpirvParser.OpUModContext ctx) {
return visitIntegerBinExpression(ctx.idResult(), ctx.idResultType(), ctx.operand1(), ctx.operand2(), UREM);
}

private Event visitIntegerUnExpression(
SpirvParser.IdResultContext idCtx,
SpirvParser.IdResultTypeContext typeCtx,
Expand Down Expand Up @@ -122,7 +127,8 @@ public Set<String> getSupportedOps() {
"OpISub",
"OpIMul",
"OpUDiv",
"OpSDiv"
"OpSDiv",
"OpUMod"
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Event visitOpSelect(SpirvParser.OpSelectContext ctx) {
"expected two operands type '%s but received '%s' and '%s'",
id, type, op1.getType(), op2.getType());
}
if (op1.getType() instanceof IntegerType) {
if (op1.getType() instanceof IntegerType || op1.getType() instanceof BooleanType) {
return builder.addEvent(new Local(register, expressions.makeITE(cond, op1, op2)));
}
throw new ParsingException("Illegal definition for '%s', " +
Expand Down

0 comments on commit 6322d95

Please sign in to comment.