Skip to content

[pull] master from golang:master#36

Merged
pull[bot] merged 2 commits into
trailofbits:masterfrom
golang:master
May 16, 2026
Merged

[pull] master from golang:master#36
pull[bot] merged 2 commits into
trailofbits:masterfrom
golang:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 16, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

neild and others added 2 commits May 15, 2026 12:36
Database drivers can support a variety of optional features.
For example, a driver.Conn can optionally implement the
Queryer and/or QueryerContext interfaces.

We currently run most database/sql tests with a general-purpose
test driver which implements most optional interfaces.

Add support for running tests with a variety of different drivers.
To start with, use two variations: A "basic" driver which only
implements the minimal mandatory interfaces, and a "default"
driver which implements most optional interfaces.

For #67546

Change-Id: I60bd02260810b6468e6b02a1ac7544406a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/766700
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Fixes #76056
Fixes #76060

If we modify the issue's fieldReduceOnce2 function to:

  // fieldReduceOnce reduces a value a < 2q.
  func fieldReduceOnce2(a uint32) fieldElement {
    x, b := bits.Sub(uint(a), uint(q), 0)
    return fieldElement(subtle.ConstantTimeSelect(int(b), int(a), int(x)))
  }

We get the wanted assembly*:
  MOVL AX, CX
  MOVL AX, DX
  SUBQ $8380417, CX
  CMOVQCS DX, CX
  MOVQ CX, AX ; not ideal code size but handled by the register renaming unit
  RET

Changes made to fieldReduceOnce2:
- fixed a bug where a and x arguments to subtle.ConstantTimeSelect were swapped.
  we should use a when the sub underflows and x otherwise.
- use bits.Sub rather than bits.Sub32 which is intriscified.

*we use CMOVQCS + MOVQ because the CMOV randomly gets generated backward,
I believe this would be fixed if we teach regalloc to commut CMOV
(by swapping the two register args and inverting the condition).

Change-Id: I01eca545d3c5c8a1c1f5a107e0089f715359dfc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/778141
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
@pull pull Bot locked and limited conversation to collaborators May 16, 2026
@pull pull Bot added the ⤵️ pull label May 16, 2026
@pull pull Bot merged commit ea094c6 into trailofbits:master May 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants