Skip to content

Commit 31525e9

Browse files
committed
cmd/compile: disable merge conditional branches pass
It's late in the cycle, let's just disable this new pass and try again for 1.28. Update #80102 Change-Id: Idcda2814e22f017999813a52b06013df3735bf18 Reviewed-on: https://go-review.googlesource.com/c/go/+/799700 Reviewed-by: Chencheng Jiang <dorbmons@gmail.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
1 parent 0969751 commit 31525e9

2 files changed

Lines changed: 9 additions & 40 deletions

File tree

src/cmd/compile/internal/ssa/compile.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,9 @@ var passes = [...]pass{
503503
{name: "checkLower", fn: checkLower, required: true},
504504
{name: "loop invariant", fn: licm},
505505
{name: "late phielim and copyelim", fn: copyelim},
506-
{name: "tighten", fn: tighten, required: true}, // move values closer to their uses
507-
{name: "merge conditional branches", fn: mergeConditionalBranches}, // generate conditional comparison instructions on ARM64 architecture
506+
{name: "tighten", fn: tighten, required: true}, // move values closer to their uses
507+
// TODO: fix 80102 and re-enable.
508+
//{name: "merge conditional branches", fn: mergeConditionalBranches}, // generate conditional comparison instructions on ARM64 architecture
508509
{name: "late deadcode", fn: deadcode},
509510
{name: "critical", fn: critical, required: true}, // remove critical edges
510511
{name: "phi tighten", fn: phiTighten}, // place rematerializable phi args near uses to reduce value lifetimes

test/codegen/comparisons.go

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ func CmpToZero_ex5(e, f int32, u uint32) int {
462462

463463
func UintLtZero(a uint8, b uint16, c uint32, d uint64) int {
464464
// amd64: -`(TESTB|TESTW|TESTL|TESTQ|JCC|JCS)`
465-
// arm64: -`(CMPW|CMP|CCMP|CCMPW|BHS|BLO)`
465+
// arm64: -`(CMPW|CMP|BHS|BLO)`
466466
if a < 0 || b < 0 || c < 0 || d < 0 {
467467
return 1
468468
}
@@ -471,77 +471,45 @@ func UintLtZero(a uint8, b uint16, c uint32, d uint64) int {
471471

472472
func UintGeqZero(a uint8, b uint16, c uint32, d uint64) int {
473473
// amd64: -`(TESTB|TESTW|TESTL|TESTQ|JCS|JCC)`
474-
// arm64: -`(CMPW|CMP|CCMP|CCMPW|BLO|BHS)`
474+
// arm64: -`(CMPW|CMP|BLO|BHS)`
475475
if a >= 0 || b >= 0 || c >= 0 || d >= 0 {
476476
return 1
477477
}
478478
return 0
479479
}
480480

481481
func UintGtZero(a uint8, b uint16, c uint32, d uint64) int {
482-
// arm64: `(CMPW|CMP|CCMP|CCMPW|BNE|BEQ)`
482+
// arm64: `(CBN?ZW)` `(CBN?Z[^W])` -`(CMPW|CMP|BLS|BHI)`
483483
if a > 0 || b > 0 || c > 0 || d > 0 {
484484
return 1
485485
}
486486
return 0
487487
}
488488

489489
func UintLeqZero(a uint8, b uint16, c uint32, d uint64) int {
490-
// arm64: `(CMPW|CMP|CCMP|CCMPW|BNE|BEQ)`
490+
// arm64: `(CBN?ZW)` `(CBN?Z[^W])` -`(CMPW|CMP|BHI|BLS)`
491491
if a <= 0 || b <= 0 || c <= 0 || d <= 0 {
492492
return 1
493493
}
494494
return 0
495495
}
496496

497497
func UintLtOne(a uint8, b uint16, c uint32, d uint64) int {
498-
// arm64: `(CMPW|CMP|CCMP|CCMPW|BNE|BEQ)`
498+
// arm64: `(CBN?ZW)` `(CBN?Z[^W])` -`(CMPW|CMP|BHS|BLO)`
499499
if a < 1 || b < 1 || c < 1 || d < 1 {
500500
return 1
501501
}
502502
return 0
503503
}
504504

505505
func UintGeqOne(a uint8, b uint16, c uint32, d uint64) int {
506-
// arm64: `(CMPW|CMP|CCMP|CCMPW|BNE|BEQ)`
506+
// arm64: `(CBN?ZW)` `(CBN?Z[^W])` -`(CMPW|CMP|BLO|BHS)`
507507
if a >= 1 || b >= 1 || c >= 1 || d >= 1 {
508508
return 1
509509
}
510510
return 0
511511
}
512512

513-
func ConditionalCompareUint8(a, b uint8) int {
514-
// arm64:"CCMPW EQ, R[0-9]+, [$]1, [$]0"
515-
if a == 1 && b == 1 {
516-
return 1
517-
}
518-
return 0
519-
}
520-
521-
func ConditionalCompareInt16(a, b int16) int {
522-
// arm64:"CCMPW LE, R[0-9]+, R[0-9]+, [$]4"
523-
if a > 3 || a == b {
524-
return 1
525-
}
526-
return 0
527-
}
528-
529-
func ConditionalCompareUint32(a, b uint32) int {
530-
// arm64:"CCMPW LO, R[0-9]+, [$]28, [$]2"
531-
if a > b && a < 28 {
532-
return 1
533-
}
534-
return 0
535-
}
536-
537-
func ConditionalCompareInt64(a, b int64) int {
538-
// arm64:"CCMP GT, R[0-9]+, R[0-9]+, [$]0"
539-
if a <= 16 || a != b {
540-
return 1
541-
}
542-
return 0
543-
}
544-
545513
func CmpToZeroU_ex1(a uint8, b uint16, c uint32, d uint64) int {
546514
// wasm:"I64Eqz" -"I64LtU"
547515
if 0 < a {

0 commit comments

Comments
 (0)