aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/GenericOpcodes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/CodeGen/GenericOpcodes.cpp')
-rw-r--r--backend/lib/CodeGen/GenericOpcodes.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/backend/lib/CodeGen/GenericOpcodes.cpp b/backend/lib/CodeGen/GenericOpcodes.cpp
index f3ff5f1..ef51147 100644
--- a/backend/lib/CodeGen/GenericOpcodes.cpp
+++ b/backend/lib/CodeGen/GenericOpcodes.cpp
@@ -451,7 +451,13 @@ private:
if (Predicate == nullptr || ((Generic == GO::G_ICMP) != Predicate->isInteger())) {
return semanticError("generic comparison predicate kind does not match its opcode");
}
- return requireI1WithShape(TypeAt(0), TypeAt(2), false);
+ const LowLevelType Result = TypeAt(0);
+ const LowLevelType Compared = TypeAt(2);
+ if (!Compared.isVector())
+ return Result.isCategoryNeutralScalar()
+ ? Expected<void>{}
+ : semanticError("scalar generic comparison requires a scalar integer result");
+ return requireI1WithShape(Result, Compared, false);
}
case GO::G_SCMP:
case GO::G_UCMP: