|
Pete Wilson |
at Feb 27, 2013 at 4:01 pm
|
⇧ |
| |
While not relevant to current go compilers, most/many VLIW machines
naturally support multiple assignment in the hardware. The actual
instruction for x,y = y, x is generally one which simply executes x = y and
y = x concurrently, but with the semantic rule that all the right hands are
evaluated first and in parallel, and then all the right hands are executed
in parallel. In the processor pipeline, all the source registers are read
in parallel, an operation (a null op in this case) is performed in the next
stage, and then in the next stage the values are all written in parallel.
On Tue, Feb 26, 2013 at 11:29 PM, Michael Jones <m...@google.com<javascript:>
wrote:
The exchange operation
x, y = y, x
certainly suggests
t := x
x = y
y = t
...but a compiler, with no spare registers, might choose to code it as
x ^= y
y ^= x
x ^= y
where the values x and y are treated as if they are 8, 16, 32, or 64 bit
ints no matter what their actual types might be.
On Tue, Feb 26, 2013 at 12:47 PM, Patrick Mylund Nielsen <
pat...@patrickmylund.com <javascript:>> wrote:
Temporary value, then.
On Tue, Feb 26, 2013 at 6:38 PM, Kyle Lemons <kev...@google.com<javascript:>
wrote:
Technically I think it evaluates and stores in registers before
assigning. It's not temporary "variables" as such.
On Tue, Feb 26, 2013 at 8:45 AM, Patrick Mylund Nielsen <
pat...@patrickmylund.com <javascript:>> wrote:
Yes, a, b = b, a uses a temp variable
On Tue, Feb 26, 2013 at 5:40 PM, OscarRyz <osca...@gmail.com<javascript:>
--
You received this message because you are subscribed to the Google
Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to golang-nuts...@googlegroups.com <javascript:>.
For more options, visit
https://groups.google.com/groups/opt_out.--
You received this message because you are subscribed to the Google
Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to golang-nuts...@googlegroups.com <javascript:>.
For more options, visit
https://groups.google.com/groups/opt_out.--
Michael T. Jones | Chief Technology Advocate | m...@google.com<javascript:>
+1 650-335-5765
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.