diff --git a/src/metal.jl b/src/metal.jl index 19ac6f1a..e82c9ade 100644 --- a/src/metal.jl +++ b/src/metal.jl @@ -894,7 +894,7 @@ function lower_llvm_intrinsics!(@nospecialize(job::CompilerJob), fun::LLVM.Funct function type_suffix(typ) # XXX: can't we use LLVM to do this kind of mangling? if typ isa LLVM.IntegerType - (signed::Bool ? "s" : "u") * "$(width(typ))" + "i$(width(typ))" elseif typ == LLVM.HalfType() "f16" elseif typ == LLVM.FloatType() @@ -907,7 +907,12 @@ function lower_llvm_intrinsics!(@nospecialize(job::CompilerJob), fun::LLVM.Funct error("Unsupported intrinsic type: $typ") end end - fn *= "." * type_suffix(typ) + + if typ isa LLVM.IntegerType || (typ isa LLVM.VectorType && eltype(typ) isa LLVM.IntegerType) + fn *= "." * (signed::Bool ? "s" : "u") * "." * type_suffix(typ) + else + fn *= "." * type_suffix(typ) + end new_intr = if haskey(functions(mod), fn) functions(mod)[fn] diff --git a/test/metal_tests.jl b/test/metal_tests.jl index df21184b..81978486 100644 --- a/test/metal_tests.jl +++ b/test/metal_tests.jl @@ -87,7 +87,7 @@ end (NTuple{2, VecElement{Int64}}, NTuple{2, VecElement{Int64}}), x, y) ir = sprint(io->Metal.code_llvm(io, foo, (NTuple{2, VecElement{Int64}}, NTuple{2, VecElement{Int64}}))) - @test occursin("air.max.v2s64", ir) + @test occursin("air.max.s.v2i64", ir) end end