Skip to content

Commit cbb9f23

Browse files
committed
support a silly number of returns
1 parent 67f4232 commit cbb9f23

File tree

4 files changed

+39
-35
lines changed

4 files changed

+39
-35
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LoopVectorization"
22
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
33
authors = ["Chris Elrod <[email protected]>"]
4-
version = "0.12.115"
4+
version = "0.12.116"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/getconstindexes.jl

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
for (i, f) enumerate((
1+
const EXTRACTFUNS = (
2+
:first,
23
:second,
34
:third,
45
:fourth,
@@ -11,6 +12,34 @@ for (i, f) ∈ enumerate((
1112
:eleventh,
1213
:twelfth,
1314
:thirteenth,
14-
))
15-
@eval @inline $f(x) = @inbounds getindex(x, $(i + 1))
15+
:fourteenth,
16+
:fifteenth,
17+
:sixteenth,
18+
:seventeenth,
19+
:eighteenth,
20+
:nineteenth,
21+
:twentieth,
22+
:twentyfirst,
23+
:twentysecond,
24+
:twentythird,
25+
:twentyfourth,
26+
:twentyfifth,
27+
:twentysixth,
28+
:twentyseventh,
29+
:twentyeighth,
30+
:twentyninth,
31+
:thirtieth,
32+
:thirtyfirst,
33+
:thirtysecond,
34+
:thirtythird,
35+
:thirtyfourth,
36+
:thirtyfifth,
37+
:thirtysixth,
38+
:thirtyseventh,
39+
:thirtyeighth,
40+
:last)
41+
42+
for (i, f) enumerate(EXTRACTFUNS)
43+
(i == 1 || i == length(EXTRACTFUNS)) && continue
44+
@eval @inline $f(x) = @inbounds getindex(x, $i)
1645
end

src/modeling/costs.jl

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,6 @@ const COST = Dict{Symbol,InstructionCost}(
253253
:adjoint => InstructionCost(0, 0.0, 0.0, 0),
254254
:conj => InstructionCost(0, 0.0, 0.0, 0),
255255
:transpose => InstructionCost(0, 0.0, 0.0, 0),
256-
:first => InstructionCost(0, 0.0, 0.0, 0),
257-
:second => InstructionCost(0, 0.0, 0.0, 0),
258-
:third => InstructionCost(0, 0.0, 0.0, 0),
259-
:fourth => InstructionCost(0, 0.0, 0.0, 0),
260-
:fifth => InstructionCost(0, 0.0, 0.0, 0),
261-
:sixth => InstructionCost(0, 0.0, 0.0, 0),
262-
:seventh => InstructionCost(0, 0.0, 0.0, 0),
263-
:eighth => InstructionCost(0, 0.0, 0.0, 0),
264-
:ninth => InstructionCost(0, 0.0, 0.0, 0),
265-
:tenth => InstructionCost(0, 0.0, 0.0, 0),
266-
:eleventh => InstructionCost(0, 0.0, 0.0, 0),
267-
:twelfth => InstructionCost(0, 0.0, 0.0, 0),
268-
:thirteenth => InstructionCost(0, 0.0, 0.0, 0),
269-
:last => InstructionCost(0, 0.0, 0.0, 0),
270256
:prefetch => InstructionCost(0, 0.0, 0.0, 0),
271257
:prefetch0 => InstructionCost(0, 0.0, 0.0, 0),
272258
:prefetch1 => InstructionCost(0, 0.0, 0.0, 0),
@@ -280,6 +266,10 @@ const COST = Dict{Symbol,InstructionCost}(
280266
:significand => InstructionCost(8, 1.0),
281267
)
282268

269+
for f = EXTRACTFUNS
270+
COST[f] = InstructionCost(0, 0.0, 0.0, 0)
271+
end
272+
283273
# # @inline prefetch0(x::Ptr, i) = VectorizationBase.prefetch(x, Val{3}(), Val{0}())
284274
# @inline prefetch0(x, i) = VectorizationBase.prefetch(gep(stridedpointer(x), (data(i),)), Val{3}(), Val{0}())
285275
# @inline prefetch0(x, I::Tuple) = VectorizationBase.prefetch(gep(x, I), Val{3}(), Val{0}())

src/modeling/graphs.jl

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ function unpack_tuple!(ls::LoopSet, LHS::Expr, RHS, elementbytes::Int, position:
15281528
end
15291529
return last(operations(ls)) # FIXME: dummy
15301530
end
1531-
@assert length(LHS.args) 14 "Functions returning more than 9 values aren't currently supported."
1531+
@assert length(LHS.args) length(EXTRACTFUNS) "Functions returning more than $(length(EXTRACTFUNS)) values aren't currently supported."
15321532
lhstemp = gensym!(ls, "lhstuple")
15331533
vparents = Operation[maybe_const_compute!(
15341534
ls,
@@ -1548,22 +1548,7 @@ function unpack_tuple!(
15481548
position::Int,
15491549
)
15501550
for i eachindex(LHS.args)
1551-
f = (
1552-
:first,
1553-
:second,
1554-
:third,
1555-
:fourth,
1556-
:fifth,
1557-
:sixth,
1558-
:seventh,
1559-
:eighth,
1560-
:ninth,
1561-
:tenth,
1562-
:eleventh,
1563-
:twelfth,
1564-
:thirteenth,
1565-
:last,
1566-
)[i]
1551+
f = EXTRACTFUNS[i]
15671552
lhsi = LHS.args[i]
15681553
if lhsi isa Symbol
15691554
add_compute!(ls, lhsi, f, vparents, elementbytes)

0 commit comments

Comments
 (0)