Skip to content

Commit 3b70ce2

Browse files
committed
Merge bitcoin/bitcoin#29846: guix: replace GCC unaligned VMOV patch with binutils patch
a0dc2eb guix: replace GCC unaligned VMOV patch with binutils patch (fanquake) Pull request description: Rather than invasively patching GCC, given we have binutils 2.38 available, we can patch it to flip the default for `-muse-unaligned-vector-move`. A 1 line binutils patch, is much more maintainable than the ~300 line patch into GCC. It's also a slight inprovement in regards to patching out ualigned instructions in the release binaries. For comparison: Master: ```bash objdump -D bin/*.exe | rg "vmova|vmovdqa|vmovaps|vmovapd|vmovdqa64|vmovdqa32" 141b8be20: c5 f8 28 1a vmovaps(%rdx), %xmm3 1420564b3: c5 79 29 36 vmovapd%xmm14, (%rsi) 1403060f3: c5 79 29 36 vmovapd%xmm14, (%rsi) 140792b13: c5 79 29 36 vmovapd%xmm14, (%rsi) 140cb0693: c5 79 29 36 vmovapd%xmm14, (%rsi) 1415ea0f3: c5 79 29 36 vmovapd%xmm14, (%rsi) ``` This PR: ```bash objdump -D bin/*.exe | rg "vmova|vmovdqa|vmovaps|vmovapd|vmovdqa64|vmovdqa32" 141b8be20: c5 f8 28 1a vmovaps(%rdx), %xmm3 1420564b3: c5 79 29 36 vmovapd%xmm14, (%rsi) 1403060f3: c5 79 29 36 vmovapd%xmm14, (%rsi) 140792b13: c5 79 29 36 vmovapd%xmm14, (%rsi) 140cb0693: c5 79 29 36 vmovapd%xmm14, (%rsi) ``` ACKs for top commit: laanwj: Code review ACK a0dc2eb Tree-SHA512: b3b6dcd2efaaa825d32c768302651d26a120a3e47b93fafb862a1884ff68fd96edb42ea9bc9974c005c8f5a1d15c217deec0ed462cc4a3365cab1bad5a0b5fef
2 parents 8cd9475 + a0dc2eb commit 3b70ce2

File tree

3 files changed

+28
-291
lines changed

3 files changed

+28
-291
lines changed

contrib/guix/manifest.scm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,15 @@ desirable for building Bitcoin Core release binaries."
110110

111111
(define (gcc-mingw-patches gcc)
112112
(package-with-extra-patches gcc
113-
(search-our-patches "gcc-remap-guix-store.patch"
114-
"vmov-alignment.patch")))
113+
(search-our-patches "gcc-remap-guix-store.patch")))
114+
115+
(define (binutils-mingw-patches binutils)
116+
(package-with-extra-patches binutils
117+
(search-our-patches "binutils-unaligned-default.patch")))
115118

116119
(define (make-mingw-pthreads-cross-toolchain target)
117120
"Create a cross-compilation toolchain package for TARGET"
118-
(let* ((xbinutils (cross-binutils target))
121+
(let* ((xbinutils (binutils-mingw-patches (cross-binutils target)))
119122
(pthreads-xlibc mingw-w64-x86_64-winpthreads)
120123
(pthreads-xgcc (cross-gcc target
121124
#:xgcc (gcc-mingw-patches mingw-w64-base-gcc)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
commit 6537181f59ed186a341db621812a6bc35e22eaf6
2+
Author: fanquake <fanquake@gmail.com>
3+
Date: Wed Apr 10 12:15:52 2024 +0200
4+
5+
build: turn on -muse-unaligned-vector-move by default
6+
7+
This allows us to avoid (more invasively) patching GCC, to avoid
8+
unaligned instruction use.
9+
10+
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
11+
index e0632681477..14a9653abdf 100644
12+
--- a/gas/config/tc-i386.c
13+
+++ b/gas/config/tc-i386.c
14+
@@ -801,7 +801,7 @@ static unsigned int no_cond_jump_promotion = 0;
15+
static unsigned int sse2avx;
16+
17+
/* Encode aligned vector move as unaligned vector move. */
18+
-static unsigned int use_unaligned_vector_move;
19+
+static unsigned int use_unaligned_vector_move = 1;
20+
21+
/* Encode scalar AVX instructions with specific vector length. */
22+
static enum

contrib/guix/patches/vmov-alignment.patch

Lines changed: 0 additions & 288 deletions
This file was deleted.

0 commit comments

Comments
 (0)