The BITCON test, isbitcon, assumes 32-bit constants are expanded
repeatedly, i.e. by copying the low 32 bits to high 32 bits,
instead of zero extending. We already do such expansion in
progedit. In con32class when classifying 32-bit constants, we
should use the expanded constant, instead of zero-extending it.
TODO: we could have better encoding for things like ANDW $-1, Rx.
Fixes #38946.
Change-Id: I37d0c95d744834419db5c897fd1f6c187595c926
Reviewed-on: https://go-review.googlesource.com/c/go/+/232984
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
ADDW $0x60060, R2 // ADDW $393312, R2 // 4280011142804111
CMPW $0x60060, R2 // CMPW $393312, R2 // 1b0c8052db00a0725f001b6b
+ // TODO: this could have better encoding
+ ANDW $-1, R10 // 1b0080124a011b0a
+
AND $8, R0, RSP // 1f007d92
ORR $8, R0, RSP // 1f007db2
EOR $8, R0, RSP // 1f007dd2
}
if isaddcon(int64(v)) {
if v <= 0xFFF {
- if isbitcon(uint64(v)) {
+ if isbitcon(uint64(a.Offset)) {
return C_ABCON0
}
return C_ADDCON0
}
- if isbitcon(uint64(v)) {
+ if isbitcon(uint64(a.Offset)) {
return C_ABCON
}
if movcon(int64(v)) >= 0 {
t := movcon(int64(v))
if t >= 0 {
- if isbitcon(uint64(v)) {
+ if isbitcon(uint64(a.Offset)) {
return C_MBCON
}
return C_MOVCON
t = movcon(int64(^v))
if t >= 0 {
- if isbitcon(uint64(v)) {
+ if isbitcon(uint64(a.Offset)) {
return C_MBCON
}
return C_MOVCON
}
- if isbitcon(uint64(v)) {
+ if isbitcon(uint64(a.Offset)) {
return C_BITCON
}