// loadByType returns the load instruction of the given type.
func loadByType(t *types.Type) obj.As {
// Avoid partial register write
- if !t.IsFloat() && t.Size() <= 2 {
- if t.Size() == 1 {
+ if !t.IsFloat() {
+ switch t.Size() {
+ case 1:
return x86.AMOVBLZX
- } else {
+ case 2:
return x86.AMOVWLZX
}
}
p := s.Prog(v.Op.Asm())
val := v.AuxInt
// 0 means math.RoundToEven, 1 Floor, 2 Ceil, 3 Trunc
- if val != 0 && val != 1 && val != 2 && val != 3 {
+ if val < 0 || val > 3 {
v.Fatalf("Invalid rounding mode")
}
p.From.Offset = val
`
}
- if phase == "check" && flag == "on" {
- checkEnabled = val != 0
- debugPoset = checkEnabled // also turn on advanced self-checking in prove's datastructure
- return ""
- }
- if phase == "check" && flag == "off" {
- checkEnabled = val == 0
- debugPoset = checkEnabled
- return ""
- }
- if phase == "check" && flag == "seed" {
- checkEnabled = true
- checkRandSeed = val
- debugPoset = checkEnabled
- return ""
+ if phase == "check" {
+ switch flag {
+ case "on":
+ checkEnabled = val != 0
+ debugPoset = checkEnabled // also turn on advanced self-checking in prove's datastructure
+ return ""
+ case "off":
+ checkEnabled = val == 0
+ debugPoset = checkEnabled
+ return ""
+ case "seed":
+ checkEnabled = true
+ checkRandSeed = val
+ debugPoset = checkEnabled
+ return ""
+ }
}
alltime := false
allmem := false
alldump := false
if phase == "all" {
- if flag == "time" {
+ switch flag {
+ case "time":
alltime = val != 0
- } else if flag == "mem" {
+ case "mem":
allmem = val != 0
- } else if flag == "dump" {
+ case "dump":
alldump = val != 0
if alldump {
BuildDump = valString
}
- } else {
+ default:
return fmt.Sprintf("Did not find a flag matching %s in -d=ssa/%s debug option", flag, phase)
}
}
// loadByType returns the load instruction of the given type.
func loadByType(t *types.Type) obj.As {
// Avoid partial register write
- if !t.IsFloat() && t.Size() <= 2 {
- if t.Size() == 1 {
+ if !t.IsFloat() {
+ switch t.Size() {
+ case 1:
return x86.AMOVBLZX
- } else {
+ case 2:
return x86.AMOVWLZX
}
}