22 lines
741 B
Plaintext
22 lines
741 B
Plaintext
;;;; A hot loop of arithmetic and nothing else: no calls, no arrays, no
|
|
;;;; copies.
|
|
;;;;
|
|
;;;; The suspected cost is that every intermediate lives in a frame slot --
|
|
;;;; this backend allocates no registers, so an expression tree becomes a
|
|
;;;; chain of stores and reloads. The tree here is deliberately deep and
|
|
;;;; entirely dependent, so a register allocator would keep all of it in
|
|
;;;; registers and this backend cannot keep any of it.
|
|
|
|
(defn main [] i32
|
|
(let [acc (i64 1)]
|
|
(dotimes [i 5000000]
|
|
(let [a (+ acc 3)
|
|
b (* a 2)
|
|
c (- b 1)
|
|
d (bit-xor c 7)
|
|
e (+ d (* a 5))
|
|
f (- e (bit-and d 15))]
|
|
(set acc (+ (% f 1000003) 1))))
|
|
(print acc) (println ""))
|
|
0)
|