@@ -2865,7 +2865,19 @@ func (s *state) conv(n ir.Node, v *ssa.Value, ft, tt *types.Type) *ssa.Value {
2865
2865
}
2866
2866
2867
2867
if ft .IsFloat () || tt .IsFloat () {
2868
- conv , ok := fpConvOpToSSA [twoTypes {s .concreteEtype (ft ), s .concreteEtype (tt )}]
2868
+ cft , ctt := s .concreteEtype (ft ), s .concreteEtype (tt )
2869
+ conv , ok := fpConvOpToSSA [twoTypes {cft , ctt }]
2870
+ // there's a change to a conversion-op table, this restores the old behavior if ConvertHash is false.
2871
+ // use salted hash to distinguish unsigned convert at a Pos from signed convert at a Pos
2872
+ if ctt == types .TUINT32 && ft .IsFloat () && ! base .ConvertHash .MatchPosWithInfo (n .Pos (), "U" , nil ) {
2873
+ // revert to old behavior
2874
+ conv .op1 = ssa .OpCvt64Fto64
2875
+ if cft == types .TFLOAT32 {
2876
+ conv .op1 = ssa .OpCvt32Fto64
2877
+ }
2878
+ conv .op2 = ssa .OpTrunc64to32
2879
+
2880
+ }
2869
2881
if s .config .RegSize == 4 && Arch .LinkArch .Family != sys .MIPS && ! s .softFloat {
2870
2882
if conv1 , ok1 := fpConvOpToSSA32 [twoTypes {s .concreteEtype (ft ), s .concreteEtype (tt )}]; ok1 {
2871
2883
conv = conv1
@@ -5862,6 +5874,7 @@ func (s *state) floatToUint(cvttab *f2uCvtTab, n ir.Node, x *ssa.Value, ft, tt *
5862
5874
// cutoff:=1<<(intY_Size-1)
5863
5875
// if x < floatX(cutoff) {
5864
5876
// result = uintY(x) // bThen
5877
+ // // gated by ConvertHash, clamp negative inputs to zero
5865
5878
// if x < 0 { // unlikely
5866
5879
// result = 0 // bZero
5867
5880
// }
@@ -5879,7 +5892,8 @@ func (s *state) floatToUint(cvttab *f2uCvtTab, n ir.Node, x *ssa.Value, ft, tt *
5879
5892
b .Likely = ssa .BranchLikely
5880
5893
5881
5894
var bThen , bZero * ssa.Block
5882
- newConversion := base .ConvertHash .MatchPos (n .Pos (), nil )
5895
+ // use salted hash to distinguish unsigned convert at a Pos from signed convert at a Pos
5896
+ newConversion := base .ConvertHash .MatchPosWithInfo (n .Pos (), "U" , nil )
5883
5897
if newConversion {
5884
5898
bZero = s .f .NewBlock (ssa .BlockPlain )
5885
5899
bThen = s .f .NewBlock (ssa .BlockIf )
0 commit comments