rawgins(as, &n1, n2)
}
-/*
- * generate
- * as n, $c (CMP)
- */
-func ginscon2(as obj.As, n2 *gc.Node, c int64) {
- var n1 gc.Node
-
- gc.Nodconst(&n1, gc.Types[gc.TINT64], c)
-
- switch as {
- default:
- gc.Fatalf("ginscon2")
-
- case arm64.ACMP:
- if -arm64.BIG <= c && c <= arm64.BIG {
- gcmp(as, n2, &n1)
- return
- }
- }
-
- // MOV n1 into register first
- var ntmp gc.Node
- gc.Regalloc(&ntmp, gc.Types[gc.TINT64], nil)
-
- rawgins(arm64.AMOVD, &n1, &ntmp)
- gcmp(as, n2, &ntmp)
- gc.Regfree(&ntmp)
-}
-
// gins is called by the front end.
// It synthesizes some multiple-instruction sequences
// so the front end can stay simpler.
return nil // caller must not use
}
}
- if as == arm64.ACMP {
- if x, ok := t.IntLiteral(); ok {
- ginscon2(as, f, x)
- return nil // caller must not use
- }
- }
return rawgins(as, f, t)
}
rawgins(as, &n1, n2)
}
-/*
- * generate
- * as n, $c (CMP/CMPU)
- */
-func ginscon2(as obj.As, n2 *gc.Node, c int64) {
- var n1 gc.Node
-
- gc.Nodconst(&n1, gc.Types[gc.TINT64], c)
-
- switch as {
- default:
- gc.Fatalf("ginscon2")
-
- case ppc64.ACMP:
- if -ppc64.BIG <= c && c <= ppc64.BIG {
- rawgins(as, n2, &n1)
- return
- }
-
- case ppc64.ACMPU:
- if 0 <= c && c <= 2*ppc64.BIG {
- rawgins(as, n2, &n1)
- return
- }
- }
-
- // MOV n1 into register first
- var ntmp gc.Node
- gc.Regalloc(&ntmp, gc.Types[gc.TINT64], nil)
-
- rawgins(ppc64.AMOVD, &n1, &ntmp)
- rawgins(as, n2, &ntmp)
- gc.Regfree(&ntmp)
-}
-
// gins is called by the front end.
// It synthesizes some multiple-instruction sequences
// so the front end can stay simpler.
return nil // caller must not use
}
}
- if as == ppc64.ACMP || as == ppc64.ACMPU {
- if x, ok := t.IntLiteral(); ok {
- ginscon2(as, f, x)
- return nil // caller must not use
- }
- }
return rawgins(as, f, t)
}
rawgins(as, &n1, n2)
}
-// generate
-// as n, $c (CMP/CMPU)
-func ginscon2(as obj.As, n2 *gc.Node, c int64) {
- var n1 gc.Node
-
- gc.Nodconst(&n1, gc.Types[gc.TINT64], c)
-
- switch as {
- default:
- gc.Fatalf("ginscon2")
-
- case s390x.ACMP:
- if -s390x.BIG <= c && c <= s390x.BIG {
- rawgins(as, n2, &n1)
- return
- }
-
- case s390x.ACMPU:
- if 0 <= c && c <= 2*s390x.BIG {
- rawgins(as, n2, &n1)
- return
- }
- }
-
- // MOV n1 into register first
- var ntmp gc.Node
- gc.Regalloc(&ntmp, gc.Types[gc.TINT64], nil)
-
- rawgins(s390x.AMOVD, &n1, &ntmp)
- rawgins(as, n2, &ntmp)
- gc.Regfree(&ntmp)
-}
-
// gmvc tries to move f to t using a mvc instruction.
// If successful it returns true, otherwise it returns false.
func gmvc(f, t *gc.Node) bool {
return nil // caller must not use
}
}
- if as == s390x.ACMP || as == s390x.ACMPU {
- if x, ok := intLiteral(t); ok {
- ginscon2(as, f, x)
- return nil // caller must not use
- }
- }
}
return rawgins(as, f, t)
}