@@ -300,27 +300,33 @@ end
300300 end
301301end
302302
303- @generated function minus_tuple (tup:: NTuple{N,T} ) where {N,T}
304- T <: SIMDType || return tupexpr (i -> :(- tup[$ i]), N)
305-
306- S = julia_type_to_llvm_type (T)
307- VT = NTuple{N, VecElement{T}}
308- if T <: SIMDFloat
309- llvmir = """
310- %res = fneg nsz contract <$N x $S > %0
311- ret <$N x $S > %res
312- """
313- else
314- llvmir = """
315- %res = sub <$N x $S > zeroinitializer, %0
316- ret <$N x $S > %res
317- """
303+ if VERSION >= v " 1.4" # fsub requires LLVM 8 (Julia 1.4)
304+ @generated function minus_tuple (tup:: NTuple{N,T} ) where {N,T}
305+ T <: SIMDType || return tupexpr (i -> :(- tup[$ i]), N)
306+
307+ S = julia_type_to_llvm_type (T)
308+ VT = NTuple{N, VecElement{T}}
309+ if T <: SIMDFloat
310+ llvmir = """
311+ %res = fneg nsz contract <$N x $S > %0
312+ ret <$N x $S > %res
313+ """
314+ else
315+ llvmir = """
316+ %res = sub <$N x $S > zeroinitializer, %0
317+ ret <$N x $S > %res
318+ """
319+ end
320+
321+ quote
322+ $ (Expr (:meta , :inline ))
323+ ret = Base. llvmcall ($ llvmir, $ VT, Tuple{$ VT}, $ VT (tup))
324+ Base. @ntuple $ N i-> ret[i]. value
325+ end
318326 end
319-
320- quote
321- $ (Expr (:meta , :inline ))
322- ret = Base. llvmcall ($ llvmir, $ VT, Tuple{$ VT}, $ VT (tup))
323- Base. @ntuple $ N i-> ret[i]. value
327+ else
328+ @generated function minus_tuple (tup:: NTuple{N,T} ) where {N,T}
329+ return tupexpr (i -> :(- tup[$ i]), N)
324330 end
325331end
326332
0 commit comments