我不明白这个ADD指令 - 汇编程序ARM Cortex-M0

时间:2016-02-27 10:43:29

标签: assembly arm add cortex-m

我正在学习汇编程序而且我已经找到了这个指令

Hyacinthe
Array
(
    [0] => stdClass Object
        (
            [id] => 1
            [company] => 
            [first_name] => Hyacinthe
            [last_name] => Hamon
            [email] => yayahappy@yahoo.com
            [phone] => 0671089566
            [date_created] => Fri, 26 Feb 2016 05:19:27 +0000
            [date_modified] => Fri, 26 Feb 2016 05:19:27 +0000
            [store_credit] => 0.0000
            [registration_ip_address] => 138.25.2.134
            [customer_group_id] => 0
            [notes] => 
            [tax_exempt_category] => 
            [reset_pass_on_login] => 
            [addresses] => stdClass Object
                (
                    [url] => https://store-xxxxxx.mybigcommerce.com/api/v2/customers/1/addresses.json
                    [resource] => /customers/1/addresses
                )

            [form_fields] => 
        )

    [1] => stdClass Object
        (
            [id] => 2
            [company] => Zip
            [first_name] => John
            [last_name] => Lennon
            [email] => john@beattles.com
            [phone] => 
            [date_created] => Sat, 27 Feb 2016 01:31:19 +0000
            [date_modified] => Sat, 27 Feb 2016 01:31:19 +0000
            [store_credit] => 0.0000
            [registration_ip_address] => 114.75.66.199
            [customer_group_id] => 0
            [notes] => 
            [tax_exempt_category] => 
            [reset_pass_on_login] => 
            [addresses] => stdClass Object
                (
                    [url] => https://store-xxxxxx.mybigcommerce.com/api/v2/customers/2/addresses.json
                    [resource] => /customers/2/addresses
                )

            [form_fields] => 
        )

)

我知道它将R0的内容乘以3,但我不明白它是如何工作的(我不知道LSL在这种情况下做了什么)。

感谢您的时间

2 个答案:

答案 0 :(得分:4)

LSL意味着左移。

所以它确实:

R0 = R0 + (R0 << 1) = R0 + R0 * 2

答案 1 :(得分:1)

LSL是左移操作,由桶形移位器执行。 桶式移位器是arm架构中提供的硬件,用于组合这种操作以提高代码密度和执行速度。

例如,在这种情况下,如果通过两条指令执行加法和移位(第一次左移然后加法),那么它将降低代码密度(一条额外指令)以及执行额外指令。

在该指令中,两个操作都在同一个循环中执行。