aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/gc/testdata
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2015-09-15 09:02:07 -0700
committerKeith Randall <khr@golang.org>2015-09-15 17:48:25 +0000
commitcde977c23cbf5fb29f12bcbca5164530d0256019 (patch)
tree5dad98ec958c26df659c65fa33512a1307ea3fc6 /src/cmd/compile/internal/gc/testdata
parente3869a6b65bb0f95dac7eca3d86055160b12589f (diff)
downloadgo-cde977c23cbf5fb29f12bcbca5164530d0256019.tar.xz
[dev.ssa] cmd/compile/internal/ssa: fix sign extension + load combo
Load-and-sign-extend opcodes were being generated in the wrong block, leading to having more than one memory variable live at once. Fix the rules + add a test. Change-Id: Iadf80e55ea901549c15c628ae295c2d0f1f64525 Reviewed-on: https://go-review.googlesource.com/14591 Reviewed-by: Todd Neal <todd@tneal.org> Run-TryBot: Todd Neal <todd@tneal.org>
Diffstat (limited to 'src/cmd/compile/internal/gc/testdata')
-rw-r--r--src/cmd/compile/internal/gc/testdata/loadstore_ssa.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/gc/testdata/loadstore_ssa.go b/src/cmd/compile/internal/gc/testdata/loadstore_ssa.go
index cf37095742..e986f53bc6 100644
--- a/src/cmd/compile/internal/gc/testdata/loadstore_ssa.go
+++ b/src/cmd/compile/internal/gc/testdata/loadstore_ssa.go
@@ -57,10 +57,31 @@ func testStoreSize_ssa(p *uint16, q *uint16, v uint32) {
var failed = false
+func testExtStore_ssa(p *byte, b bool) int {
+ switch {
+ }
+ x := *p
+ *p = 7
+ if b {
+ return int(x)
+ }
+ return 0
+}
+
+func testExtStore() {
+ const start = 8
+ var b byte = start
+ if got := testExtStore_ssa(&b, true); got != start {
+ fmt.Println("testExtStore failed. want =", start, ", got =", got)
+ failed = true
+ }
+}
+
func main() {
testLoadStoreOrder()
testStoreSize()
+ testExtStore()
if failed {
panic("failed")