Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpUMod #781

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be not really related to the support for OpUMod and more of a "general fix". Am I right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I need both for the empirical tests, and didn't want to create a separate commit just for this boolean.

return builder.addEvent(new Local(register, expressions.makeITE(cond, op1, op2)));
}
throw new ParsingException("Illegal definition for '%s', " +
Expand Down
Loading