]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: avoid extending floating point comparision on riscv64
authorJoel Sing <joel@sing.id.au>
Sat, 27 Aug 2022 16:30:58 +0000 (02:30 +1000)
committerJoel Sing <joel@sing.id.au>
Wed, 31 Aug 2022 20:05:46 +0000 (20:05 +0000)
The result of these operations are already extended.

Change-Id: Ifc8ba362dda7035d8fd0d40046a96f61d3082877
Reviewed-on: https://go-review.googlesource.com/c/go/+/426260
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/RISCV64.rules
src/cmd/compile/internal/ssa/rewriteRISCV64.go

index ee82c15f95df278f8aae620e87c0474aeb4686af..bf466206c11f7433a59b2620a392ee0e7702f208 100644 (file)
 (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem) => (MOVDstorezero [off] {sym} ptr mem)
 
 // Boolean ops are already extended.
+(MOVBUreg x:((FLES|FLTS|FEQS|FNES) _ _)) => x
+(MOVBUreg x:((FLED|FLTD|FEQD|FNED) _ _)) => x
 (MOVBUreg x:((SEQZ|SNEZ) _)) => x
 (MOVBUreg x:((SLT|SLTU) _ _)) => x
 
index 0aba7e70dbc20f404bcc02dc2cf7e2c8622e948e..45d82187a53dad7ab5146b6db53454383bffd03f 100644 (file)
@@ -3160,6 +3160,86 @@ func rewriteValueRISCV64_OpRISCV64MOVBUload(v *Value) bool {
 func rewriteValueRISCV64_OpRISCV64MOVBUreg(v *Value) bool {
        v_0 := v.Args[0]
        b := v.Block
+       // match: (MOVBUreg x:(FLES _ _))
+       // result: x
+       for {
+               x := v_0
+               if x.Op != OpRISCV64FLES {
+                       break
+               }
+               v.copyOf(x)
+               return true
+       }
+       // match: (MOVBUreg x:(FLTS _ _))
+       // result: x
+       for {
+               x := v_0
+               if x.Op != OpRISCV64FLTS {
+                       break
+               }
+               v.copyOf(x)
+               return true
+       }
+       // match: (MOVBUreg x:(FEQS _ _))
+       // result: x
+       for {
+               x := v_0
+               if x.Op != OpRISCV64FEQS {
+                       break
+               }
+               v.copyOf(x)
+               return true
+       }
+       // match: (MOVBUreg x:(FNES _ _))
+       // result: x
+       for {
+               x := v_0
+               if x.Op != OpRISCV64FNES {
+                       break
+               }
+               v.copyOf(x)
+               return true
+       }
+       // match: (MOVBUreg x:(FLED _ _))
+       // result: x
+       for {
+               x := v_0
+               if x.Op != OpRISCV64FLED {
+                       break
+               }
+               v.copyOf(x)
+               return true
+       }
+       // match: (MOVBUreg x:(FLTD _ _))
+       // result: x
+       for {
+               x := v_0
+               if x.Op != OpRISCV64FLTD {
+                       break
+               }
+               v.copyOf(x)
+               return true
+       }
+       // match: (MOVBUreg x:(FEQD _ _))
+       // result: x
+       for {
+               x := v_0
+               if x.Op != OpRISCV64FEQD {
+                       break
+               }
+               v.copyOf(x)
+               return true
+       }
+       // match: (MOVBUreg x:(FNED _ _))
+       // result: x
+       for {
+               x := v_0
+               if x.Op != OpRISCV64FNED {
+                       break
+               }
+               v.copyOf(x)
+               return true
+       }
        // match: (MOVBUreg x:(SEQZ _))
        // result: x
        for {