1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/test/CodeGen/X86/dagcombine-and-setcc.ll
David Blaikie 3ea2df7c7b [opaque pointer type] Add textual IR support for explicit type parameter to gep operator
Similar to gep (r230786) and load (r230794) changes.

Similar migration script can be used to update test cases, which
successfully migrated all of LLVM and Polly, but about 4 test cases
needed manually changes in Clang.

(this script will read the contents of stdin and massage it into stdout
- wrap it in the 'apply.sh' script shown in previous commits + xargs to
apply it over a large set of test cases)

import fileinput
import sys
import re

rep = re.compile(r"(getelementptr(?:\s+inbounds)?\s*\()((<\d*\s+x\s+)?([^@]*?)(|\s*addrspace\(\d+\))\s*\*(?(3)>)\s*)(?=$|%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|zeroinitializer|<|\[\[[a-zA-Z]|\{\{)", re.MULTILINE | re.DOTALL)

def conv(match):
  line = match.group(1)
  line += match.group(4)
  line += ", "
  line += match.group(2)
  return line

line = sys.stdin.read()
off = 0
for match in re.finditer(rep, line):
  sys.stdout.write(line[off:match.start()])
  sys.stdout.write(conv(match))
  off = match.end()
sys.stdout.write(line[off:])

llvm-svn: 232184
2015-03-13 18:20:45 +00:00

48 lines
1.2 KiB
LLVM

; RUN: llc < %s | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10.0"
; Function Attrs: nounwind
declare i32 @printf(i8* nocapture readonly, ...)
; On X86 1 is true and 0 is false, so we can't perform the combine:
; (and (setgt X, true), (setgt Y, true)) -> (setgt (or X, Y), true)
; This combine only works if the true value is -1.
;CHECK: cmpl
;CHECK: setg
;CHECK: cmpl
;CHECK: setg
;CHECK: andb
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: optsize ssp uwtable
define i32 @foo(i32 %a, i32 %b, i32 * %c) {
if.else429:
%cmp.i1144 = icmp eq i32* %c, null
%cmp430 = icmp slt i32 %a, 2
%cmp432 = icmp slt i32 %b, 2
%or.cond710 = or i1 %cmp430, %cmp432
%or.cond710.not = xor i1 %or.cond710, true
%brmerge1448 = or i1 %cmp.i1144, %or.cond710.not
br i1 %brmerge1448, label %ret1, label %ret2
ret1:
ret i32 0
ret2:
ret i32 1
}
define i32 @main(i32 %argc, i8** nocapture readnone %argv) {
%res = alloca i32, align 4
%t = call i32 @foo(i32 1, i32 2, i32* %res) #3
%v = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %t)
ret i32 0
}