fn cmpTag(
self: *WipFunction,
tag: Instruction.Tag,
lhs: Value,
rhs: Value,
name: []const u8,
) Allocator.Error!Value self: *WipFunctiontag: Instruction.Taglhs: Valuerhs: Valuename: []const u87951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014 fn cmpTag(
self: *WipFunction,
tag: Instruction.Tag,
lhs: Value,
rhs: Value,
name: []const u8,
) Allocator.Error!Value {
switch (tag) {
.@"fcmp false",
.@"fcmp fast false",
.@"fcmp fast oeq",
.@"fcmp fast oge",
.@"fcmp fast ogt",
.@"fcmp fast ole",
.@"fcmp fast olt",
.@"fcmp fast one",
.@"fcmp fast ord",
.@"fcmp fast true",
.@"fcmp fast ueq",
.@"fcmp fast uge",
.@"fcmp fast ugt",
.@"fcmp fast ule",
.@"fcmp fast ult",
.@"fcmp fast une",
.@"fcmp fast uno",
.@"fcmp oeq",
.@"fcmp oge",
.@"fcmp ogt",
.@"fcmp ole",
.@"fcmp olt",
.@"fcmp one",
.@"fcmp ord",
.@"fcmp true",
.@"fcmp ueq",
.@"fcmp uge",
.@"fcmp ugt",
.@"fcmp ule",
.@"fcmp ult",
.@"fcmp une",
.@"fcmp uno",
.@"icmp eq",
.@"icmp ne",
.@"icmp sge",
.@"icmp sgt",
.@"icmp sle",
.@"icmp slt",
.@"icmp uge",
.@"icmp ugt",
.@"icmp ule",
.@"icmp ult",
=> assert(lhs.typeOfWip(self) == rhs.typeOfWip(self)),
else => unreachable,
}
_ = try lhs.typeOfWip(self).changeScalar(.i1, self.builder);
try self.ensureUnusedExtraCapacity(1, Instruction.Binary, 0);
const instruction = try self.addInst(name, .{
.tag = tag,
.data = self.addExtraAssumeCapacity(Instruction.Binary{
.lhs = lhs,
.rhs = rhs,
}),
});
return instruction.toValue();
}