Explorar el Código

Support delocating vpbroadcastq.

(This can be generated with -mavx2.)

Change-Id: I6d92d9e93eb448357342ef86d050321f0ef40f9e
Reviewed-on: https://boringssl-review.googlesource.com/24504
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
kris/onging/CECPQ3_patch15
Adam Langley hace 6 años
committed by CQ bot account: commit-bot@chromium.org
padre
commit
ef16f19ef2
Se han modificado 3 ficheros con 48 adiciones y 0 borrados
  1. +22
    -0
      util/fipstools/delocate.go
  2. +4
    -0
      util/fipstools/testdata/x86_64-GOTRewrite/in.s
  3. +22
    -0
      util/fipstools/testdata/x86_64-GOTRewrite/out.s

+ 22
- 0
util/fipstools/delocate.go Ver fichero

@@ -792,6 +792,9 @@ type instructionType int
const (
instrPush instructionType = iota
instrMove
// instrTransformingMove is essentially a move, but it performs some
// transformation of the data during the process.
instrTransformingMove
instrJump
instrConditionalMove
instrOther
@@ -818,6 +821,11 @@ func classifyInstruction(instr string, args []*node32) instructionType {
if len(args) == 1 {
return instrJump
}

case "vpbroadcastq":
if len(args) == 2 {
return instrTransformingMove
}
}

return instrOther
@@ -870,6 +878,13 @@ func moveTo(w stringWriter, target string, isAVX bool) wrapperFunc {
}
}

func finalTransform(w stringWriter, transformInstruction, reg string) wrapperFunc {
return func(k func()) {
k()
w.WriteString("\t" + transformInstruction + " " + reg + ", " + reg + "\n")
}
}

func isValidLEATarget(reg string) bool {
return !strings.HasPrefix(reg, "%xmm") && !strings.HasPrefix(reg, "%ymm") && !strings.HasPrefix(reg, "%zmm")
}
@@ -1018,6 +1033,13 @@ Args:
case instrMove:
assertNodeType(argNodes[1], ruleRegisterOrConstant)
targetReg = d.contents(argNodes[1])
case instrTransformingMove:
assertNodeType(argNodes[1], ruleRegisterOrConstant)
targetReg = d.contents(argNodes[1])
wrappers = append(wrappers, finalTransform(d.output, instructionName, targetReg))
if isValidLEATarget(targetReg) {
return nil, fmt.Errorf("Currently transforming moves are assumed to target XMM registers. Otherwise we'll pop %rax before reading it to do the transform.")
}
default:
return nil, fmt.Errorf("Cannot rewrite GOTPCREL reference for instruction %q", instructionName)
}


+ 4
- 0
util/fipstools/testdata/x86_64-GOTRewrite/in.s Ver fichero

@@ -34,4 +34,8 @@ foo:
movq foobar_bss_get@GOTPCREL(%rip), %r11
movq OPENSSL_ia32cap_get@GOTPCREL(%rip), %r11

# Transforming moves run the transform in-place after the load.
vpbroadcastq stderr@GOTPCREL(%rip), %xmm0
vpbroadcastq foo@GOTPCREL(%rip), %xmm0

.comm foobar,64,32

+ 22
- 0
util/fipstools/testdata/x86_64-GOTRewrite/out.s Ver fichero

@@ -124,6 +124,28 @@ foo:
# WAS movq OPENSSL_ia32cap_get@GOTPCREL(%rip), %r11
leaq OPENSSL_ia32cap_get(%rip), %r11

# Transforming moves run the transform in-place after the load.
# WAS vpbroadcastq stderr@GOTPCREL(%rip), %xmm0
leaq -128(%rsp), %rsp
pushq %rax
pushf
leaq stderr_GOTPCREL_external(%rip), %rax
addq (%rax), %rax
movq (%rax), %rax
popf
vmovq %rax, %xmm0
popq %rax
leaq 128(%rsp), %rsp
vpbroadcastq %xmm0, %xmm0
# WAS vpbroadcastq foo@GOTPCREL(%rip), %xmm0
leaq -128(%rsp), %rsp
pushq %rax
leaq .Lfoo_local_target(%rip), %rax
vmovq %rax, %xmm0
popq %rax
leaq 128(%rsp), %rsp
vpbroadcastq %xmm0, %xmm0

.comm foobar,64,32
.text
BORINGSSL_bcm_text_end:


Cargando…
Cancelar
Guardar