lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Wed, Jul 20, 2011 at 3:43 PM, David Kastrup <dak@gnu.org> wrote:
Mike Pall <mikelu-1107@mike.de> writes:

> Benjamin Segovia wrote:
>
>> It is more complicated to generate the code like that because there
>> may be a lot of "break instruction" (the machine supports native
>> structured branch instructions) and this will require to _nest_ more
>> and more successive basic blocks into if statements.
>
> I do not see how that's different from doing it with a while loop.
> You'd need to nest them and close them with 'end' as well.

No, you need just a single loop at a time that can deal with dozens of
"break" in there.


So instead of:

while true do
   {... a lot of compute ...}
   if some_condition_on_the_lane_of_the_simd_vector then break end
   {... a lot of compute ...}
   break -- this one is to exit anyway
end

you could generate

(function ()
   {... a lot of compute ...}
   if some_condition_on_the_lane_of_the_simd_vector then return end
   {... a lot of compute ...}
   return
end)()

But I'm probably missing something.

Robby