You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Optimise this to make this a flat array of 5 elements? perhaps 8 for cache alignment? or does just the whole thing need to be cache aligned?
// curious optimisation cases
Player_State :: struct #raw_union {
using _: _Player_State_1,
using _: _Player_State_2,
using _: _Player_State_3,
using _: _Player_State_4,
using _: _Player_State_5,
}
main :: proc(){
fmt.printf("Hello, world! Your Odin project is set up.\n")
honk:Player_State
honk.which = ._Universal
honk.p_state = ._5
honk.c_state = ._5S
for i in cast(i32)0..=27 {
result := GET_ANIM_IDX_ORIGINAL(HBOX_DURATIONS_CLASSIC[._5S], i)
assert(result == expected_5S_index[i])
}
fmt.printf("Original test passed!")
for i in cast(i32)0..=27 {
result := GET_ANIM_IDX_SIMD(_5S_SIMD, i)
assert(result == expected_5S_index[i])
}
fmt.printf("SIMD test passed!")
result:i32
// prof.TIME_TYPE = .micros
fmt.printf("Original algorithm: ")
for x in 0..<1_000_000 {
for i in cast(i32)0..=27 {
// prof.profile_start(.micros)
result = GET_ANIM_IDX_ORIGINAL(HBOX_DURATIONS_CLASSIC[._5S], i)
// prof.profile_end()
assert(result != -1)
}
}
// prof.average_profiling_data()
fmt.printf("SIMD algorithm: ")
for x in 0..<1_000_000 {
for i in cast(i32)0..=27 {
// prof.profile_start(.micros)
result = GET_ANIM_IDX_SIMD(_5S_SIMD, i)
// prof.profile_end()
assert(result != -1)
}
}
// prof.average_profiling_data()
fmt.printf("cursed %v \n", honk.which)
};
The text was updated successfully, but these errors were encountered:
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
odin report
output:Odin: dev-2024-12:597fba7c3
OS: Windows 10 Professional (version: 20H2), build 19042.1706
CPU: Intel(R) Core(TM) i7-10700KF CPU @ 3.80GHz
RAM: 32637 MiB
Backend: LLVM 18.1.8
Expected Behavior
LLVM compiles the proc GET_ANIM_IDX_SIMD correctly
Current Behavior
Following llvm error is generated with "odin run .":
`
LLVM CODE GEN FAILED FOR PROCEDURE: main.GET_ANIM_IDX_SIMD
define i32 @main.GET_ANIM_IDX_SIMD(ptr %0, i32 %1, ptr noalias nocapture nonnull %__.context_ptr) {
decls:
%2 = alloca <4 x i32>, align 16
%3 = alloca i32, align 4
%4 = alloca <4 x i32>, align 16
%INDICES = alloca <4 x i32>, align 16
%GT = alloca <4 x i32>, align 16
%result = alloca i32, align 4
br label %entry
entry: ; preds = %decls
call void @llvm.memcpy.inline.p0.p0.i64(ptr %2, ptr %0, i64 16, i1 false)
store i32 %1, ptr %3, align 4
store <4 x i32> zeroinitializer, ptr %4, align 16
%5 = insertelement <4 x i32> zeroinitializer, i32 %1, i32 0
%6 = insertelement <4 x i32> %5, i32 %1, i32 1
%7 = insertelement <4 x i32> %6, i32 %1, i32 2
%8 = insertelement <4 x i32> %7, i32 %1, i32 3
store <4 x i32> %8, ptr %4, align 16
%9 = load <4 x i32>, ptr %4, align 16
store <4 x i32> %9, ptr %INDICES, align 16
%10 = load <4 x i32>, ptr %2, align 16
%11 = icmp sgt <4 x i32> %10, i32 %1
%12 = sext <4 x i1> %11 to <4 x i32>
store <4 x i32> %12, ptr %GT, align 16
%13 = load <4 x i32>, ptr %GT, align 16
%14 = sub <4 x i32> zeroinitializer, %13
store <4 x i32> %14, ptr %GT, align 16
%15 = load <4 x i32>, ptr %GT, align 16
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %15)
store i32 %16, ptr %result, align 4
%17 = load i32, ptr %result, align 4
ret i32 %17
}
Both operands to ICmp instruction are not of the same type!
%11 = icmp sgt <4 x i32> %10, i32 %1
Steps to Reproduce
Run the provided code
The text was updated successfully, but these errors were encountered: