llvm-6502/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll
David Blaikie 7c9c6ed761 [opaque pointer type] Add textual IR support for explicit type parameter to load instruction
Essentially the same as the GEP change in r230786.

A similar migration script can be used to update test cases, though a few more
test case improvements/changes were required this time around: (r229269-r229278)

import fileinput
import sys
import re

pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)")

for line in sys.stdin:
  sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line))

Reviewers: rafael, dexonsmith, grosser

Differential Revision: http://reviews.llvm.org/D7649

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-27 21:17:42 +00:00

351 lines
10 KiB
LLVM

; RUN: opt < %s -basicaa -slp-vectorizer -S | FileCheck %s
; Check propagation of optional IR flags (PR20802). For a flag to
; propagate from scalar instructions to their vector replacement,
; *all* scalar instructions must have the flag.
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-unknown"
; CHECK-LABEL: @exact(
; CHECK: lshr exact <4 x i32>
define void @exact(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = lshr exact i32 %load1, 1
%op2 = lshr exact i32 %load2, 1
%op3 = lshr exact i32 %load3, 1
%op4 = lshr exact i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}
; CHECK-LABEL: @not_exact(
; CHECK: lshr <4 x i32>
define void @not_exact(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = lshr exact i32 %load1, 1
%op2 = lshr i32 %load2, 1
%op3 = lshr exact i32 %load3, 1
%op4 = lshr exact i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}
; CHECK-LABEL: @nsw(
; CHECK: add nsw <4 x i32>
define void @nsw(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = add nsw i32 %load1, 1
%op2 = add nsw i32 %load2, 1
%op3 = add nsw i32 %load3, 1
%op4 = add nsw i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}
; CHECK-LABEL: @not_nsw(
; CHECK: add <4 x i32>
define void @not_nsw(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = add nsw i32 %load1, 1
%op2 = add nsw i32 %load2, 1
%op3 = add nsw i32 %load3, 1
%op4 = add i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}
; CHECK-LABEL: @nuw(
; CHECK: add nuw <4 x i32>
define void @nuw(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = add nuw i32 %load1, 1
%op2 = add nuw i32 %load2, 1
%op3 = add nuw i32 %load3, 1
%op4 = add nuw i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}
; CHECK-LABEL: @not_nuw(
; CHECK: add <4 x i32>
define void @not_nuw(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = add nuw i32 %load1, 1
%op2 = add i32 %load2, 1
%op3 = add i32 %load3, 1
%op4 = add nuw i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}
; CHECK-LABEL: @nnan(
; CHECK: fadd nnan <4 x float>
define void @nnan(float* %x) {
%idx1 = getelementptr inbounds float, float* %x, i64 0
%idx2 = getelementptr inbounds float, float* %x, i64 1
%idx3 = getelementptr inbounds float, float* %x, i64 2
%idx4 = getelementptr inbounds float, float* %x, i64 3
%load1 = load float, float* %idx1, align 4
%load2 = load float, float* %idx2, align 4
%load3 = load float, float* %idx3, align 4
%load4 = load float, float* %idx4, align 4
%op1 = fadd fast nnan float %load1, 1.0
%op2 = fadd nnan ninf float %load2, 1.0
%op3 = fadd nsz nnan float %load3, 1.0
%op4 = fadd arcp nnan float %load4, 1.0
store float %op1, float* %idx1, align 4
store float %op2, float* %idx2, align 4
store float %op3, float* %idx3, align 4
store float %op4, float* %idx4, align 4
ret void
}
; CHECK-LABEL: @not_nnan(
; CHECK: fadd <4 x float>
define void @not_nnan(float* %x) {
%idx1 = getelementptr inbounds float, float* %x, i64 0
%idx2 = getelementptr inbounds float, float* %x, i64 1
%idx3 = getelementptr inbounds float, float* %x, i64 2
%idx4 = getelementptr inbounds float, float* %x, i64 3
%load1 = load float, float* %idx1, align 4
%load2 = load float, float* %idx2, align 4
%load3 = load float, float* %idx3, align 4
%load4 = load float, float* %idx4, align 4
%op1 = fadd nnan float %load1, 1.0
%op2 = fadd ninf float %load2, 1.0
%op3 = fadd nsz float %load3, 1.0
%op4 = fadd arcp float %load4, 1.0
store float %op1, float* %idx1, align 4
store float %op2, float* %idx2, align 4
store float %op3, float* %idx3, align 4
store float %op4, float* %idx4, align 4
ret void
}
; CHECK-LABEL: @only_fast(
; CHECK: fadd fast <4 x float>
define void @only_fast(float* %x) {
%idx1 = getelementptr inbounds float, float* %x, i64 0
%idx2 = getelementptr inbounds float, float* %x, i64 1
%idx3 = getelementptr inbounds float, float* %x, i64 2
%idx4 = getelementptr inbounds float, float* %x, i64 3
%load1 = load float, float* %idx1, align 4
%load2 = load float, float* %idx2, align 4
%load3 = load float, float* %idx3, align 4
%load4 = load float, float* %idx4, align 4
%op1 = fadd fast nnan float %load1, 1.0
%op2 = fadd fast nnan ninf float %load2, 1.0
%op3 = fadd fast nsz nnan float %load3, 1.0
%op4 = fadd arcp nnan fast float %load4, 1.0
store float %op1, float* %idx1, align 4
store float %op2, float* %idx2, align 4
store float %op3, float* %idx3, align 4
store float %op4, float* %idx4, align 4
ret void
}
; CHECK-LABEL: @only_arcp(
; CHECK: fadd arcp <4 x float>
define void @only_arcp(float* %x) {
%idx1 = getelementptr inbounds float, float* %x, i64 0
%idx2 = getelementptr inbounds float, float* %x, i64 1
%idx3 = getelementptr inbounds float, float* %x, i64 2
%idx4 = getelementptr inbounds float, float* %x, i64 3
%load1 = load float, float* %idx1, align 4
%load2 = load float, float* %idx2, align 4
%load3 = load float, float* %idx3, align 4
%load4 = load float, float* %idx4, align 4
%op1 = fadd fast float %load1, 1.0
%op2 = fadd fast float %load2, 1.0
%op3 = fadd fast float %load3, 1.0
%op4 = fadd arcp float %load4, 1.0
store float %op1, float* %idx1, align 4
store float %op2, float* %idx2, align 4
store float %op3, float* %idx3, align 4
store float %op4, float* %idx4, align 4
ret void
}
; CHECK-LABEL: @addsub_all_nsw
; CHECK: add nsw <4 x i32>
; CHECK: sub nsw <4 x i32>
define void @addsub_all_nsw(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = add nsw i32 %load1, 1
%op2 = sub nsw i32 %load2, 1
%op3 = add nsw i32 %load3, 1
%op4 = sub nsw i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}
; CHECK-LABEL: @addsub_some_nsw
; CHECK: add nsw <4 x i32>
; CHECK: sub <4 x i32>
define void @addsub_some_nsw(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = add nsw i32 %load1, 1
%op2 = sub nsw i32 %load2, 1
%op3 = add nsw i32 %load3, 1
%op4 = sub i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}
; CHECK-LABEL: @addsub_no_nsw
; CHECK: add <4 x i32>
; CHECK: sub <4 x i32>
define void @addsub_no_nsw(i32* %x) {
%idx1 = getelementptr inbounds i32, i32* %x, i64 0
%idx2 = getelementptr inbounds i32, i32* %x, i64 1
%idx3 = getelementptr inbounds i32, i32* %x, i64 2
%idx4 = getelementptr inbounds i32, i32* %x, i64 3
%load1 = load i32, i32* %idx1, align 4
%load2 = load i32, i32* %idx2, align 4
%load3 = load i32, i32* %idx3, align 4
%load4 = load i32, i32* %idx4, align 4
%op1 = add i32 %load1, 1
%op2 = sub nsw i32 %load2, 1
%op3 = add nsw i32 %load3, 1
%op4 = sub i32 %load4, 1
store i32 %op1, i32* %idx1, align 4
store i32 %op2, i32* %idx2, align 4
store i32 %op3, i32* %idx3, align 4
store i32 %op4, i32* %idx4, align 4
ret void
}