@@ -515,20 +515,28 @@ function pointerremcomparison(
515515 end
516516end
517517
518- @generated function of_same_size (:: Type{T} , :: Type{S} ) where {T,S}
518+ @generated function of_same_size (:: Type{T} , :: Type{S} , :: StaticInt{R} ) where {T,S,R }
519519 sizeof_S = sizeof (S)
520+ if T <: Integer && sizeof (T) == 8
521+ # sizeof(T) == 8 && max(..., 4) to maybe demote Int64 -> Int32
522+ # but otherwise, we're giving up too much with the demotion.
523+ sizeof_S *= max (8 ÷ R, 4 )
524+ end
520525 sizeof (T) == sizeof_S && return T
521526 # Tfloat = T <: Union{Float32,Float64}
522527 if T <: Union{Float32,Float64}
523528 sizeof_S ≥ 8 ? Float64 : Float32
524529 elseif T <: Signed
525- Symbol (:Int , 8 sizeof_S )
530+ Symbol (:Int , sizeof_S )
526531 elseif (T <: Unsigned ) | (T === Bool)
527- Symbol (:UInt , 8 sizeof_S )
532+ Symbol (:UInt , sizeof_S )
528533 else
529534 S
530535 end
531536end
537+ @inline function of_same_size (:: Type{T} , :: Type{S} ) where {T,S}
538+ of_same_size (T, S, VectorizationBase. register_size () ÷ VectorizationBase. simd_integer_register_size ())
539+ end
532540function outer_reduction_zero (
533541 op:: Operation ,
534542 u₁u:: Bool ,
0 commit comments