File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -487,9 +487,13 @@ vectorizePrimOp op = case op of
487487 BinOp opk arg1 arg2 -> do
488488 sx@ (VVal vx x) <- vectorizeAtom arg1
489489 sy@ (VVal vy y) <- vectorizeAtom arg2
490- let v = case (vx, vy) of (Uniform , Uniform ) -> Uniform ; _ -> Varying
491- x' <- if vx /= v then ensureVarying sx else return x
492- y' <- if vy /= v then ensureVarying sy else return y
490+ let v = case (opk, vx, vy) of
491+ (_, Uniform , Uniform ) -> Uniform
492+ (IAdd , Uniform , Contiguous ) -> Contiguous
493+ (IAdd , Contiguous , Uniform ) -> Contiguous
494+ _ -> Varying
495+ x' <- if v == Varying then ensureVarying sx else return x
496+ y' <- if v == Varying then ensureVarying sy else return y
493497 VVal v <$> emitOp (BinOp opk x' y')
494498 MiscOp (CastOp tyArg arg) -> do
495499 ty <- vectorizeType tyArg
Original file line number Diff line number Diff line change @@ -126,13 +126,13 @@ _ = for i:(Fin 20) j:(Fin 4). ordinal j
126126"vectorizing int binary op"
127127-- CHECK-LABEL: vectorizing int binary op
128128%passes vect
129- _ = for i:(Fin 256). (n_to_i32 (ordinal i)) + 1
129+ _ = for i:(Fin 256). (n_to_i32 (ordinal i)) * 2
130130-- CHECK: seq (RawFin 0x10)
131131-- CHECK: [[i0:v#[0-9]+]]:<16xInt32> = vbroadcast
132132-- CHECK: [[i1:v#[0-9]+]]:<16xInt32> = viota
133133-- CHECK: [[i2:v#[0-9]+]]:<16xInt32> = %iadd [[i0]] [[i1]]
134- -- CHECK: [[ones :v#[0-9]+]]:<16xInt32> = vbroadcast 1
135- -- CHECK: %iadd [[i2]] [[ones ]]
134+ -- CHECK: [[twos :v#[0-9]+]]:<16xInt32> = vbroadcast 2
135+ -- CHECK: %imul [[i2]] [[twos ]]
136136
137137"vectorizing float binary op"
138138-- CHECK-LABEL: vectorizing float binary op
You can’t perform that action at this time.
0 commit comments