Closed Drvi closed 8 months ago
Looking into this a bit more, I'm pretty sure this is a SYSV issue and that the emitted { <8 x i8>, <1 x double> }
is RegClass_SSEInt8, RecClass_SSEUp
.
This is an "educated guess" based on all the LLVM intrinsics being pulled in via the "c" calling convention and messing around with lbAbiAmd64SysV::classify_with
changing the failure.
This package for the most part might "just work" on Windows with my branch but the code generation will still be utterly attrocious due to SROA being disabled (so all the force_inline intrinsics will spend a lot of time fucking around with loads/stores).
This might need a calling convention special case since these aren't really C functions but compiler builtins.
Per laytanl, on windows the error is:
LLVM CODE GEN FAILED FOR PROCEDURE: simd_x86._mm_movemask_epi8
; Function Attrs: alwaysinline
define internal i32 @simd_x86._mm_movemask_epi8(ptr %0) #5 {
decls:
%1 = alloca <16 x i8>, align 16
br label %entry
entry: ; preds = %decls
%2 = load <2 x i64>, ptr %0, align 16
%3 = bitcast <2 x i64> %2 to <16 x i8>
store <16 x i8> %3, ptr %1, align 16
%4 = call i32 @llvm.x86.sse2.pmovmskb.128(ptr %1) #2
ret i32 %4
}
Intrinsic has incorrect argument type!
ptr @llvm.x86.sse2.pmovmskb.128
So it doesn't just work on Windows, but the reason for the breakage is the same in that "the platform native C calling convention is incorrect for the llvm.x86 intrinsics".
Context
odin report
:I've built Odin with LLVM 17.0.6 using this branch https://github.com/odin-lang/Odin/pull/3024 at https://github.com/odin-lang/Odin/commit/8943e94c37bd38a3bdd4a4f97a4b9baf8a2a2105. Without it, importing
"core:simd/x86"
wouldn't work.Then calling
odin build src/repro.odin -file
whererepro.odin
is:results in what seems to be a codegen bug.
Expected Behavior
The program should compile successfully and
xxx
should have 16 set bits.Current Behavior
Failure Logs
repro.ll