Skip to content

Commit

Permalink
Fix incompatible type issue with MSL output
Browse files Browse the repository at this point in the history
  • Loading branch information
fintelia committed Nov 30, 2021
1 parent fb98408 commit 39506a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/back/msl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,11 +1209,11 @@ impl<W: Write> Writer<W> {
} else if fun == Mf::FindLsb {
write!(self.out, "((({}::ctz(", NAMESPACE)?;
self.put_expression(arg, context, false)?;
write!(self.out, ") + 1) % 33) - 1)")?;
write!(self.out, ") + int(1)) % 33) - 1)")?;
} else if fun == Mf::FindMsb {
write!(self.out, "((({}::clz(", NAMESPACE)?;
self.put_expression(arg, context, false)?;
write!(self.out, ") + 1) % 33) - 1)")?;
write!(self.out, ") + int(1)) % 33) - 1)")?;
} else if fun == Mf::Unpack2x16float {
write!(self.out, "float2(as_type<half2>(")?;
self.put_expression(arg, context, false)?;
Expand Down
32 changes: 16 additions & 16 deletions tests/out/msl/bits.msl
Original file line number Diff line number Diff line change
Expand Up @@ -84,36 +84,36 @@ kernel void main_(
metal::uint4 _e116 = u4_;
u4_ = metal::extract_bits(_e116, 5u, 10u);
int _e120 = i;
i = (((metal::ctz(_e120) + 1) % 33) - 1);
i = (((metal::ctz(_e120) + int(1)) % 33) - 1);
metal::int2 _e122 = i2_;
i2_ = (((metal::ctz(_e122) + 1) % 33) - 1);
i2_ = (((metal::ctz(_e122) + int(1)) % 33) - 1);
metal::int3 _e124 = i3_;
i3_ = (((metal::ctz(_e124) + 1) % 33) - 1);
i3_ = (((metal::ctz(_e124) + int(1)) % 33) - 1);
metal::int4 _e126 = i4_;
i4_ = (((metal::ctz(_e126) + 1) % 33) - 1);
i4_ = (((metal::ctz(_e126) + int(1)) % 33) - 1);
metal::uint _e128 = u;
i = (((metal::ctz(_e128) + 1) % 33) - 1);
i = (((metal::ctz(_e128) + int(1)) % 33) - 1);
metal::uint2 _e130 = u2_;
i2_ = (((metal::ctz(_e130) + 1) % 33) - 1);
i2_ = (((metal::ctz(_e130) + int(1)) % 33) - 1);
metal::uint3 _e132 = u3_;
i3_ = (((metal::ctz(_e132) + 1) % 33) - 1);
i3_ = (((metal::ctz(_e132) + int(1)) % 33) - 1);
metal::uint4 _e134 = u4_;
i4_ = (((metal::ctz(_e134) + 1) % 33) - 1);
i4_ = (((metal::ctz(_e134) + int(1)) % 33) - 1);
int _e136 = i;
i = (((metal::clz(_e136) + 1) % 33) - 1);
i = (((metal::clz(_e136) + int(1)) % 33) - 1);
metal::int2 _e138 = i2_;
i2_ = (((metal::clz(_e138) + 1) % 33) - 1);
i2_ = (((metal::clz(_e138) + int(1)) % 33) - 1);
metal::int3 _e140 = i3_;
i3_ = (((metal::clz(_e140) + 1) % 33) - 1);
i3_ = (((metal::clz(_e140) + int(1)) % 33) - 1);
metal::int4 _e142 = i4_;
i4_ = (((metal::clz(_e142) + 1) % 33) - 1);
i4_ = (((metal::clz(_e142) + int(1)) % 33) - 1);
metal::uint _e144 = u;
i = (((metal::clz(_e144) + 1) % 33) - 1);
i = (((metal::clz(_e144) + int(1)) % 33) - 1);
metal::uint2 _e146 = u2_;
i2_ = (((metal::clz(_e146) + 1) % 33) - 1);
i2_ = (((metal::clz(_e146) + int(1)) % 33) - 1);
metal::uint3 _e148 = u3_;
i3_ = (((metal::clz(_e148) + 1) % 33) - 1);
i3_ = (((metal::clz(_e148) + int(1)) % 33) - 1);
metal::uint4 _e150 = u4_;
i4_ = (((metal::clz(_e150) + 1) % 33) - 1);
i4_ = (((metal::clz(_e150) + int(1)) % 33) - 1);
return;
}

0 comments on commit 39506a3

Please sign in to comment.