mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 06:30:19 +00:00
ae3a0be92e
integer and floating-point opcodes, introducing FAdd, FSub, and FMul. For now, the AsmParser, BitcodeReader, and IRBuilder all preserve backwards compatability, and the Core LLVM APIs preserve backwards compatibility for IR producers. Most front-ends won't need to change immediately. This implements the first step of the plan outlined here: http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
32 lines
1.2 KiB
LLVM
32 lines
1.2 KiB
LLVM
; RUN: llvm-as < %s | opt -disable-output -scalar-evolution -analyze \
|
|
; RUN: | grep { --> \{-128,+,1\}<bb1> Exits: 127} | count 5
|
|
|
|
; Convert (sext {-128,+,1}) to {sext(-128),+,sext(1)}, since the
|
|
; trip count is within range where this is safe.
|
|
|
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define void @foo(double* nocapture %x) nounwind {
|
|
bb1.thread:
|
|
br label %bb1
|
|
|
|
bb1: ; preds = %bb1, %bb1.thread
|
|
%i.0.reg2mem.0 = phi i64 [ -128, %bb1.thread ], [ %8, %bb1 ] ; <i64> [#uses=3]
|
|
%0 = trunc i64 %i.0.reg2mem.0 to i8 ; <i8> [#uses=1]
|
|
%1 = trunc i64 %i.0.reg2mem.0 to i9 ; <i8> [#uses=1]
|
|
%2 = sext i9 %1 to i64 ; <i64> [#uses=1]
|
|
%3 = getelementptr double* %x, i64 %2 ; <double*> [#uses=1]
|
|
%4 = load double* %3, align 8 ; <double> [#uses=1]
|
|
%5 = fmul double %4, 3.900000e+00 ; <double> [#uses=1]
|
|
%6 = sext i8 %0 to i64 ; <i64> [#uses=1]
|
|
%7 = getelementptr double* %x, i64 %6 ; <double*> [#uses=1]
|
|
store double %5, double* %7, align 8
|
|
%8 = add i64 %i.0.reg2mem.0, 1 ; <i64> [#uses=2]
|
|
%9 = icmp sgt i64 %8, 127 ; <i1> [#uses=1]
|
|
br i1 %9, label %return, label %bb1
|
|
|
|
return: ; preds = %bb1
|
|
ret void
|
|
}
|