@@ -2276,16 +2276,16 @@ func (b *builder) createBinOp(op token.Token, typ, ytyp types.Type, x, y llvm.Va
22762276 case token .NEQ : // !=
22772277 result := b .createRuntimeCall ("stringEqual" , []llvm.Value {x , y }, "" )
22782278 return b .CreateNot (result , "" ), nil
2279- case token .LSS : // <
2279+ case token .LSS : // x < y
22802280 return b .createRuntimeCall ("stringLess" , []llvm.Value {x , y }, "" ), nil
2281- case token .LEQ : // <=
2281+ case token .LEQ : // x <= y becomes NOT (y < x)
22822282 result := b .createRuntimeCall ("stringLess" , []llvm.Value {y , x }, "" )
22832283 return b .CreateNot (result , "" ), nil
2284- case token .GTR : // >
2284+ case token .GTR : // x > y becomes y < x
2285+ return b .createRuntimeCall ("stringLess" , []llvm.Value {y , x }, "" ), nil
2286+ case token .GEQ : // x >= y becomes NOT (x < y)
22852287 result := b .createRuntimeCall ("stringLess" , []llvm.Value {x , y }, "" )
22862288 return b .CreateNot (result , "" ), nil
2287- case token .GEQ : // >=
2288- return b .createRuntimeCall ("stringLess" , []llvm.Value {y , x }, "" ), nil
22892289 default :
22902290 panic ("binop on string: " + op .String ())
22912291 }
0 commit comments