Skip to content

Commit 0e68a52

Browse files
committed
refactor: test head with isexpr, use @turbo
1 parent 01ffa5c commit 0e68a52

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/constructors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ end
159159
# check if the body of loop is a block, if not convert it to a block issue#395
160160
function check_loopbody!(q)
161161
if q isa Expr && q.head == :for
162-
if q.args[2].head != :block
162+
if Meta.isexpr(q.args[2], :block)
163163
q.args[2] = Expr(:block, q.args[2])
164164
else
165165
for arg in q.args[2].args

test/parsing_inputs.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ macro gen_loop_issue395(ex)
55
sym, ind = ex.args
66
loop_body = :(ret[$ind] = $sym[$ind])
77
loop = Expr(:for, :($ind = axes($sym, 1)), loop_body)
8-
return esc(:(@avx $loop))
8+
return esc(:(@turbo $loop))
99
end
1010
macro gen_single_loop(B, A)
1111
loop_body = :($B[i] = $A[i])
1212
loop = Expr(:for, :(i = indices(($B, $A), 1)), loop_body)
13-
return esc(:(@avx $loop))
13+
return esc(:(@turbo $loop))
1414
end
1515
macro gen_nest_loop(C, A, B)
1616
loop_body = :($C[i, j] = $A[i] * $B[j])
1717
loop_head = Expr(:block, :(j = indices(($C, $B), (2, 1))), :(i = indices(($C, $A), 1)))
1818
loop = Expr(:for, loop_head, loop_body)
19-
return esc(:(@avx $loop))
19+
return esc(:(@turbo $loop))
2020
end
2121
macro gen_A_mul_B(C, A, B)
2222
inner_body = :(Cji += $A[j, k] * $B[k, i])
@@ -28,7 +28,7 @@ macro gen_A_mul_B(C, A, B)
2828
$C[j, i] = Cji
2929
end
3030
)
31-
return esc(:(@avx $loop))
31+
return esc(:(@turbo $loop))
3232
end
3333

3434
@testset "check_block, #395" begin

0 commit comments

Comments
 (0)