Skip to content
Snippets Groups Projects
arithmetic.go 604 B
Newer Older
  • Learn to ignore specific revisions
  • // asmcheck
    
    // Copyright 2018 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package codegen
    
    // This file contains codegen tests related to arithmetic
    // simplifications/optimizations.
    
    func Pow2Muls(n1, n2 int) (int, int) {
    	// amd64:"SHLQ\t[$]5",-"IMULQ"
    	// 386:"SHLL\t[$]5",-"IMULL"
    	// arm:"SLL\t[$]5",-"MUL"
    	// arm64:"LSL\t[$]5",-"MUL"
    	a := n1 * 32
    
    	// amd64:"SHLQ\t[$]6",-"IMULQ"
    	// 386:"SHLL\t[$]6",-"IMULL"
    	// arm:"SLL\t[$]6",-"MUL"
    	// arm64:"LSL\t[$]6",-"MUL"
    	b := -64 * n2
    
    	return a, b
    }