mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-17 03:30:28 +00:00
69ccadd753
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32115 91177308-0d34-0410-b5e6-96231b3b80d8
24 lines
593 B
Plaintext
24 lines
593 B
Plaintext
; LFTR should eliminate the need for the computation of i*i completely. It
|
|
; is only used to compute the exit value.
|
|
; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -dce | llvm-dis | not grep mul
|
|
|
|
%A = external global int
|
|
|
|
implementation
|
|
|
|
int %quadratic_setlt() { ;; for (i = 7; i*i < 1000; ++i)
|
|
entry:
|
|
br label %loop
|
|
loop:
|
|
%i = phi int [ 7, %entry ], [ %i.next, %loop ]
|
|
%i.next = add int %i, 1
|
|
store int %i, int* %A
|
|
|
|
%i2 = mul int %i, %i
|
|
%c = setlt int %i2, 1000
|
|
br bool %c, label %loop, label %loopexit
|
|
loopexit:
|
|
ret int %i
|
|
}
|
|
|