Skip to content

Conversation

@alexcrichton
Copy link
Member

This pulls in some changes recently landed upstream for WebAssembly which update opcodes and tweak a few internals about how simd is handled. This is in preparation for the recently-stabilized simd proposal to update the stdarch repo with more intrinsics.

I've tested this locally and it enables a whole slew of new intrinsics, although there will likely be another future cherry-pick or two since there's still some instructions that LLVM doesn't fully support just yet.

tlively added 4 commits March 18, 2021 11:08
Now that the WebAssembly SIMD specification is finalized and engines are
generally up-to-date, there is no need for a separate target feature for gating
SIMD instructions that engines have not implemented. With this change,
v128.const is now enabled by default with the simd128 target feature.

Differential Revision: https://reviews.llvm.org/D98457
Removes the instruction definitions, intrinsics, and builtins for qfma/qfms,
signselect, and prefetch instructions, which were not included in the final
WebAssembly SIMD spec.

Depends on D98457.

Differential Revision: https://reviews.llvm.org/D98466
Updates the names (e.g. widen => extend, saturate => sat) and opcodes of all
SIMD instructions to match the finalized SIMD spec. Deliberately does not change
the public interface in wasm_simd128.h yet; that will require more care.

Depends on D98466.

Differential Revision: https://reviews.llvm.org/D98676
@nikic
Copy link

nikic commented Mar 18, 2021

I'm a bit concerned that this breaks bitcode compatibility with clang-12. Is cross-language LTO for wasm something we need to be concerned about or not?

@alexcrichton
Copy link
Member Author

For the use case of cross-language LTO with Rust & C I think there's not much to be concerned about with the wasm target. I didn't think this would affect any other targets but if it does I can try to fix that!

@nikic
Copy link

nikic commented Mar 18, 2021

Okay, that's good enough for me...

@nikic nikic merged commit c3a26cb into rust-lang:rustc/12.0-2021-02-03 Mar 18, 2021
@alexcrichton alexcrichton deleted the wasm-simd-update branch March 18, 2021 23:02
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 18, 2021
This is a continuation of rust-lang/llvm-project#96
to continue to make progress on updating Rust's support for SIMD
intrinsics on WebAssembly to the latest version of the specification.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 19, 2021
…viper

Update LLVM to bring in SIMD updates for WebAssembly

This is a continuation of rust-lang/llvm-project#96
to continue to make progress on updating Rust's support for SIMD
intrinsics on WebAssembly to the latest version of the specification.
nikic pushed a commit that referenced this pull request May 8, 2021
This patch implemented TTI.IntImmCost() properly.
Each BPF insn has 32bit immediate space, so for any immediate
which can be represented as 32bit signed int, the cost
is technically free. If an int cannot be presented as
a 32bit signed int, a ld_imm64 instruction is needed
and a TCC_Basic is returned.

This change is motivated when we observed that
several bpf selftests failed with latest llvm trunk, e.g.,
  #10/16 strobemeta.o:FAIL
  #10/17 strobemeta_nounroll1.o:FAIL
  #10/18 strobemeta_nounroll2.o:FAIL
  #10/19 strobemeta_subprogs.o:FAIL
  #96 snprintf_btf:FAIL

The reason of the failure is due to that
SpeculateAroundPHIsPass did aggressive transformation
which alters control flow for which currently verifer
cannot handle well. In llvm12, SpeculateAroundPHIsPass
is not called.

SpeculateAroundPHIsPass relied on TTI.getIntImmCost()
and TTI.getIntImmCostInst() for profitability
analysis. This patch implemented TTI.getIntImmCost()
properly for BPF backend which also prevented
transformation which caused the above test failures.

Differential Revision: https://reviews.llvm.org/D96448

(cherry picked from commit a260ae7)
vext01 added a commit to vext01/llvm-project that referenced this pull request Oct 19, 2023
96: Kill debugging. r=ltratt a=vext01



Co-authored-by: Edd Barrett <[email protected]>
nikic pushed a commit to nikic/llvm-project that referenced this pull request Dec 21, 2023
This PR adds support for thread names in lldb on Windows.

```
(lldb) thr list
Process 2960 stopped
  thread rust-lang#53: tid = 0x03a0, 0x00007ff84582db34 ntdll.dll`NtWaitForMultipleObjects + 20
  thread rust-lang#29: tid = 0x04ec, 0x00007ff845830a14 ntdll.dll`NtWaitForAlertByThreadId + 20, name = 'SPUW.6'
  thread rust-lang#89: tid = 0x057c, 0x00007ff845830a14 ntdll.dll`NtWaitForAlertByThreadId + 20, name = 'PPU[0x1000019] physics[main]'
  thread rust-lang#3: tid = 0x0648, 0x00007ff843c2cafe combase.dll`InternalDoATClassCreate + 39518
  thread rust-lang#93: tid = 0x0688, 0x00007ff845830a14 ntdll.dll`NtWaitForAlertByThreadId + 20, name = 'PPU[0x100501d] uMovie::StreamingThread'
  thread #1: tid = 0x087c, 0x00007ff842e7a104 win32u.dll`NtUserMsgWaitForMultipleObjectsEx + 20
  thread rust-lang#96: tid = 0x0890, 0x00007ff845830a14 ntdll.dll`NtWaitForAlertByThreadId + 20, name = 'PPU[0x1002020] HLE Video Decoder'
<...>
```
wesleywiser pushed a commit to wesleywiser/llvm-project that referenced this pull request Aug 6, 2025
… >= 4G (llvm#151460)"

This reverts commit 600976f.

The test was crashing trying to access any element of the GPR struct.

(gdb) disas
Dump of assembler code for function _ZN7testing8internal11CmpHelperEQIyyEENS_15AssertionResultEPKcS4_RKT_RKT0_:
   0x00450afc <+0>:	push	{r4, r5, r6, r7, r8, r9, r10, r11, lr}
   0x00450b00 <+4>:	sub	sp, sp, rust-lang#60	; 0x3c
   0x00450b04 <+8>:	ldr	r5, [sp, rust-lang#96]	; 0x60
=> 0x00450b08 <+12>:	ldm	r3, {r4, r7}
   0x00450b0c <+16>:	ldm	r5, {r6, r9}
   0x00450b10 <+20>:	eor	r7, r7, r9
   0x00450b14 <+24>:	eor	r6, r4, r6
   0x00450b18 <+28>:	orrs	r7, r6, r7

(gdb) p/x r3
$3 = 0x3e300f6e

"However, load and store multiple instructions (LDM and STM) and load and store double-word (LDRD or STRD) must be aligned to at least a word boundary."

https://developer.arm.com/documentation/den0013/d/Porting/Alignment

>>> 0x3e300f6e % 4
2

Program received signal SIGBUS, Bus error.
0x00450b08 in testing::AssertionResult testing::internal::CmpHelperEQ<unsigned long long, unsigned long long>(char const*, char const*, unsigned long long const&, unsigned long long const&) ()

The struct is packed with 1 byte alignment, but it needs to start at an aligned address for us
to ldm from it. So I've done that with alignas.

Also fixed some compiler warnings in the test itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants