It wouldn’t compile in 0.11.0 because @abs() is missing (it was @fabs() before). I wonder if there’s a way to get the right CPU instruction in there without the use of the builtin. An undocumented internal function, perhaps? If not, I’m just going to use stick a if (v < 0) statement in there.
If you try to use @abs with 0.11, the lexer will complain, so you can’t even try to wrap this inside a comptime block. You need to prevent the lexer from seeing it. I think this would work:
cool. I never thought about it. i wonder if there is a peephole pass in llvm for this specifically? There is no neg instruction for floats, so you would think the straight forward gen would be x1 = x0 ^ 0x80000000 then MAXSS. I wonder how it gets from that to the bitmask.