Skip to content

cmd/compile: preserve guarded AMD64 FP intrinsics in LLVM - #96

Open
zhouguangyuan0718 wants to merge 1 commit into
goallc:go1.27.masterfrom
zhouguangyuan0718:codex/goobj-guarded-fp-intrinsics
Open

cmd/compile: preserve guarded AMD64 FP intrinsics in LLVM#96
zhouguangyuan0718 wants to merge 1 commit into
goallc:go1.27.masterfrom
zhouguangyuan0718:codex/goobj-guarded-fp-intrinsics

Conversation

@zhouguangyuan0718

Copy link
Copy Markdown

On AMD64, Go SSA guards SSE4.1 rounding and FMA operations with runtime.x86HasSSE41 and runtime.x86HasFMA. Lowering their true branches to generic LLVM intrinsics loses that contract at the target boundary: baseline X86 codegen may emit external trunc/floor/ceil/roundeven/fma symbols.

Use the guarded X86 intrinsics added by goallc/llvm-project#48 for AMD64 while keeping the generic LLVM intrinsics on other architectures. Update LLVM codegen expectations accordingly.

Validation:

  • rebuilt the complete Go toolchain against the matching local LLVM payload
  • TestLLVM/codegen/llvm_math_intrinsics.go passed
  • TestLLVM/codegen/llvm_trunc.go passed
  • linux/amd64 default compile, llc, GoObj archive, and final link passed for test/llvm_float_intrinsics.go
  • the same pipeline passed for test/fixedbugs/issue68322.go
  • optimized IR retained the runtime CPU-feature branches; assembly used roundsd/vfmadd213sd only on guarded paths; linked binaries had no unresolved generic FP symbols

Depends on goallc/llvm-project#48. The two runtime cases remain graylisted until linux/amd64 CI can execute them. This PR is intentionally left unmerged for review.

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/goobj-guarded-fp-intrinsics branch from 11b903b to fddbceb Compare August 6, 2026 16:17
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/goobj-guarded-fp-intrinsics branch from fddbceb to 55f4541 Compare August 6, 2026 17:30
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.

1 participant