Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/parse/add_compute.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,14 @@ function add_compute!(
end
elseif instr.instr === :oftype && length(args) == 2
return get_arg!(ls, args[2], elementbytes, position)
elseif instr.instr === :div_fast && length(args) == 2 && args[1] === 1
return add_compute!(
ls,
var,
:inv,
[get_arg!(ls, args[2], elementbytes, position)],
elementbytes
)
end
vparents = Operation[]
deps = Symbol[]
Expand Down Expand Up @@ -783,7 +791,7 @@ function get_arg!(
return xo
end
elseif x isa Number
return add_constant!(ls, x^p, elementbytes, var)::Operation
return add_constant!(ls, x, elementbytes)::Operation
else
throw("objects of type $x not supported as arg")
end
Expand Down
13 changes: 13 additions & 0 deletions test/simplemisc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ function issue480(x, y)
end
z
end

function issue539!(y, x)
@turbo for i in eachindex(x)
y[i] = 1 / x[i]
end
y
end
@testset "issue 480" begin
using LoopVectorization
x = zeros(33)
Expand All @@ -44,3 +51,9 @@ end
x[i] = 0.0
end
end

@testset "issue 539" begin
x = fill(Inf, 32)
y = similar(x)
@test all(iszero, issue539!(y, x))
end