Changeset 14033


Ignore:
Timestamp:
Jul 24, 2010, 11:31:13 PM (9 years ago)
Author:
gb
Message:

movw, movt, & support for them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/arm/compiler/ARM/arm-asm.lisp

    r14014 r14033  
    122122    :uuoC
    123123    :fpux
     124    :imm16
    124125    ))
    125126
     
    303304     #x0fff00ff
    304305     (:prefer-separate-cond))
     306
     307   ;; movw, movt require ARMv6T2 or later
     308   (define-arm-instruction movw (:rd :imm16)
     309     #x03000000
     310     #x0ff00000
     311     ())
     312   (define-arm-instruction movt (:rd :imm16)
     313     #x03400000
     314     #x0ff00000
     315     ())
    305316
    306317   (define-arm-instruction and (:rd :rn :shifter)
     
    11681179    (set-field-value instruction (byte 4 16) regno)))
    11691180
     1181(defun parse-imm16-operand (form instruction)
     1182  (unless (and (consp form)
     1183               (eq (keywordize (car form)) :$)
     1184               (consp (cdr form))
     1185               (null (cddr form)))
     1186    (error "Bad 16-bit immediate operand: ~s" form))
     1187  (let* ((val (eval (cadr form))))
     1188    (set-field-value instruction (byte 12 0) (ldb (byte 12 0) val))
     1189    (set-field-value instruction (byte 4 16) (ldb (byte 4 12) val))))
     1190   
     1191
    11701192(defun parse-rm-operand (form instruction)
    11711193  (set-field-value instruction (byte 4 0) (need-arm-gpr form)))
     
    12931315      parse-uuoc-operand
    12941316      parse-fpux-operand
     1317      parse-imm16-operand
    12951318      ))
    12961319
     
    16101633    :fpaddr-offset
    16111634    :uuoC
     1635    :imm16
    16121636    )))
    16131637
     
    16421666      vinsn-parse-uuoc-operand
    16431667      vinsn-parse-fpux-operand
     1668      vinsn-parse-imm16-operand
    16441669      ))
    16451670
     
    19511976            (error "Memory offset ~s must be a multiple of 4." offval))
    19521977          (set-avi-opcode-field avi (byte 8 0) (ash offval -2)))))))
     1978
     1979(defun vinsn-parse-imm16-operand (avi value vinsn-params)
     1980  (unless (and (consp value)
     1981               (eq (car value) :$)
     1982               (consp (cdr value))
     1983               (null (cddr value)))
     1984    (error "Bad imm16 constant operand syntax: ~s." value))
     1985  (let* ((val (vinsn-arg-or-constant avi (cadr value) vinsn-params (encode-vinsn-field-type :imm16) nil)))
     1986    (when val
     1987      (set-avi-opcode-field avi (byte 12 0) (ldb (byte 12 0) val))
     1988      (set-avi-opcode-field avi (byte 4 16) (ldb (byte 4 12) val)))))
     1989
    19531990
    19541991(defun vinsn-simplify-instruction (form vinsn-params)
     
    20282065    vinsn-insert-fpaddr-offset-operand
    20292066    vinsn-insert-uuoc-operand
     2067    vinsn-insert-imm16-operand
    20302068    ))
    20312069
     
    21352173  (set-field-value instruction (byte 8 0) (ash value -2)))
    21362174
     2175(defun vinsn-insert-imm16-operand (instruction value)
     2176  (set-field-value instruction (byte 12 0) (ldb (byte 12 0) value))
     2177  (set-field-value instruction (byte 4 16) (ldb (byte 4 12) value)))
    21372178
    21382179
Note: See TracChangeset for help on using the changeset viewer.