Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simd enablement #2945

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions doc/langref.html.in
Original file line number Diff line number Diff line change
Expand Up @@ -1246,11 +1246,13 @@ a &= b{#endsyntax#}</pre></td>
<td>
<ul>
<li>{#link|Integers#}</li>
<li>{#link|bool|Primitive Types#}</li>
</ul>
</td>
<td>Bitwise AND.
<ul>
<li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
<li>Both operands (if they are functions) are evaluated.</li>
</ul>
</td>
<td>
Expand All @@ -1263,11 +1265,13 @@ a |= b{#endsyntax#}</pre></td>
<td>
<ul>
<li>{#link|Integers#}</li>
<li>{#link|bool|Primitive Types#}</li>
</ul>
</td>
<td>Bitwise OR.
<ul>
<li>Invokes {#link|Peer Type Resolution#} for the operands.</li>
<li>Both operands (if they are functions) are evaluated.</li>
</ul>
</td>
<td>
Expand All @@ -1280,6 +1284,7 @@ a ^= b{#endsyntax#}</pre></td>
<td>
<ul>
<li>{#link|Integers#}</li>
<li>{#link|bool|Primitive Types#}</li>
</ul>
</td>
<td>Bitwise XOR.
Expand All @@ -1296,6 +1301,7 @@ a ^= b{#endsyntax#}</pre></td>
<td>
<ul>
<li>{#link|Integers#}</li>
<li>{#link|bool|Primitive Types#}</li>
</ul>
</td>
<td>
Expand All @@ -1316,6 +1322,9 @@ a ^= b{#endsyntax#}</pre></td>
returns {#syntax#}b{#endsyntax#} ("default value"),
otherwise returns the unwrapped value of {#syntax#}a{#endsyntax#}.
Note that {#syntax#}b{#endsyntax#} may be a value of type {#link|noreturn#}.
<ul>
<li>If {#syntax#}a{#endsyntax#} is {#syntax#}false{#endsyntax#}, b is not evaluated.</li>
</ul>
</td>
<td>
<pre>{#syntax#}const value: ?u32 = null;
Expand Down Expand Up @@ -6681,10 +6690,10 @@ async fn func(y: *i32) void {
{#header_open|@bitCast#}
<pre>{#syntax#}@bitCast(comptime DestType: type, value: var) DestType{#endsyntax#}</pre>
<p>
Converts a value of one type to another type.
Converts a value of one type to another type. <b>Vectors are numbered right -> left.</b>
</p>
<p>
Asserts that {#syntax#}@sizeOf(@typeOf(value)) == @sizeOf(DestType){#endsyntax#}.
Asserts that {#syntax#}@sizeOf(@typeOf(value)) == @sizeOf(DestType){#endsyntax#}, except Vectors, in which case only the number of bits must match.
</p>
<p>
Asserts that {#syntax#}@typeId(DestType) != @import("builtin").TypeId.Pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@intToPtr{#endsyntax#} if you need this.
Expand All @@ -6695,6 +6704,7 @@ async fn func(y: *i32) void {
<ul>
<li>Convert {#syntax#}f32{#endsyntax#} to {#syntax#}u32{#endsyntax#} bits</li>
<li>Convert {#syntax#}i32{#endsyntax#} to {#syntax#}u32{#endsyntax#} preserving twos complement</li>
<li>Convert {#syntax#}@Vector(4, u32){#endsyntax#} to {#syntax#}u128{#endsyntax#}. Note Vectors are numbered right -> left.</li>
</ul>
<p>
Works at compile-time if {#syntax#}value{#endsyntax#} is known at compile time. It's a compile error to bitcast a struct to a scalar type of the same size since structs have undefined layout. However if the struct is packed then it works.
Expand All @@ -6716,12 +6726,13 @@ async fn func(y: *i32) void {

{#header_open|@boolToInt#}
<pre>{#syntax#}@boolToInt(value: bool) u1{#endsyntax#}</pre>
<pre>{#syntax#}@boolToInt(value: @Vector(_, bool)) @Vector(_, u1){#endsyntax#}</pre>
<p>
Converts {#syntax#}true{#endsyntax#} to {#syntax#}u1(1){#endsyntax#} and {#syntax#}false{#endsyntax#} to
{#syntax#}u1(0){#endsyntax#}.
</p>
<p>
If the value is known at compile-time, the return type is {#syntax#}comptime_int{#endsyntax#}
If the value is known at compile-time, and is not a vector, the return type is {#syntax#}comptime_int{#endsyntax#}
instead of {#syntax#}u1{#endsyntax#}.
</p>
{#header_close#}
Expand Down Expand Up @@ -7224,7 +7235,7 @@ test "field access by string" {
{#header_open|@floatCast#}
<pre>{#syntax#}@floatCast(comptime DestType: type, value: var) DestType{#endsyntax#}</pre>
<p>
Convert from one float type to another. This cast is safe, but may cause the
Convert from one float type to another, or from int to float if no precision is lost. This cast is safe, but if down-casting a float may cause the
numeric value to lose precision.
</p>
{#header_close#}
Expand Down Expand Up @@ -7442,7 +7453,7 @@ fn add(a: i32, b: i32) i32 { return a + b; }
{#header_open|@intToFloat#}
<pre>{#syntax#}@intToFloat(comptime DestType: type, int: var) DestType{#endsyntax#}</pre>
<p>
Converts an integer to the closest floating point representation. To convert the other way, use {#link|@floatToInt#}. This cast is always safe.
Converts an integer to the closest floating point representation. To convert the other way, use {#link|@floatToInt#}. This cast is always safe, but may loose precision.
</p>
{#header_close#}

Expand Down Expand Up @@ -8131,7 +8142,7 @@ fn List(comptime T: type) type {
{#header_open|@truncate#}
<pre>{#syntax#}@truncate(comptime T: type, integer: var) T{#endsyntax#}</pre>
<p>
This function truncates bits from an integer type, resulting in a smaller
This function truncates bits from an integer type (or the integers of a vector), resulting in a smaller
or same-sized integer type.
</p>
<p>
Expand Down
Loading