diff --git a/src/cmd/compile/internal/gc/asm_test.go b/src/cmd/compile/internal/gc/asm_test.go index 57853001fd..78c6c5e2b7 100644 --- a/src/cmd/compile/internal/gc/asm_test.go +++ b/src/cmd/compile/internal/gc/asm_test.go @@ -1816,6 +1816,26 @@ var linuxS390XTests = []*asmTest{ } var linuxARMTests = []*asmTest{ + // multiplication by powers of two + { + fn: ` + func $(n int) int { + return 16*n + } + `, + pos: []string{"\tSLL\t[$]4"}, + neg: []string{"\tMUL\t"}, + }, + { + fn: ` + func $(n int) int { + return -32*n + } + `, + pos: []string{"\tSLL\t[$]5"}, + neg: []string{"\tMUL\t"}, + }, + { fn: ` func f0(x uint32) uint32 { @@ -1943,6 +1963,26 @@ var linuxARMTests = []*asmTest{ } var linuxARM64Tests = []*asmTest{ + // multiplication by powers of two + { + fn: ` + func $(n int) int { + return 64*n + } + `, + pos: []string{"\tLSL\t[$]6"}, + neg: []string{"\tMUL\t"}, + }, + { + fn: ` + func $(n int) int { + return -128*n + } + `, + pos: []string{"\tLSL\t[$]7"}, + neg: []string{"\tMUL\t"}, + }, + { fn: ` func f0(x uint64) uint64 {