1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2023-2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
; RUN: %opt %use_old_pass_manager% -GenXLegalization -march=genx64 -mcpu=Gen9 -mtriple=spir64-unknown-unknown -S < %s | FileCheck %s
declare <16 x float> @llvm.genx.ieee.sqrt.v16f32(<16 x float>)
declare <16 x float> @llvm.genx.ieee.div.v16f32(<16 x float>, <16 x float>)
; NO SPLIT
; CHECK-LABEL: @test1
; CHECK: add <16 x i32>
define <16 x i32> @test1(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1>
ret <16 x i32> %and
}
; CHECK-LABEL: @test2
; CHECK: add <16 x i32>
define <16 x i32> @test2(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0>
ret <16 x i32> %and
}
; CHECK-LABEL: @test3
; CHECK: add <16 x i32>
define <16 x i32> @test3(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; SPLIT 8
; CHECK-LABEL: @test4
; CHECK: add <8 x i32>
; CHECK: add <8 x i32>
define <16 x i32> @test4(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; CHECK-LABEL: @test5
; CHECK: add <8 x i32>
; CHECK: add <8 x i32>
define <16 x i32> @test5(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0>
ret <16 x i32> %and
}
; CHECK-LABEL: @test6
; CHECK: add <4 x i32>
; CHECK: add <8 x i32>
; CHECK: add <4 x i32>
define <16 x i32> @test6(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; SPLIT 4
; CHECK-LABEL: @test7
; CHECK: add <4 x i32>
; CHECK: add <8 x i32>
; CHECK: add <4 x i32>
define <16 x i32> @test7(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 1, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; CHECK-LABEL: @test8
; CHECK: add <8 x i32>
; CHECK: add <4 x i32>
; CHECK: add <4 x i32>
define <16 x i32> @test8(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 1>
ret <16 x i32> %and
}
; CHECK-LABEL: @test9
; CHECK: add <4 x i32>
; CHECK: add <4 x i32>
; CHECK: add <8 x i32>
define <16 x i32> @test9(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; SPLIT 2
; CHECK-LABEL: @test10
; CHECK: add <2 x i32>
; CHECK: add <8 x i32>
; CHECK: add <4 x i32>
; CHECK: add <2 x i32>
define <16 x i32> @test10(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; CHECK-LABEL: @test11
; CHECK: add <8 x i32>
; CHECK: add <2 x i32>
; CHECK: add <4 x i32>
; CHECK: add <2 x i32>
define <16 x i32> @test11(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; CHECK-LABEL: @test12
; CHECK: add <4 x i32>
; CHECK: add <2 x i32>
; CHECK: add <8 x i32>
; CHECK: add <2 x i32>
define <16 x i32> @test12(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; SPLIT 1
; CHECK-LABEL: @test13
; CHECK: add <1 x i32>
; CHECK: add <8 x i32>
; CHECK: add <4 x i32>
; CHECK: add <2 x i32>
; CHECK: add <1 x i32>
define <16 x i32> @test13(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; CHECK-LABEL: @test14
; CHECK: add <4 x i32>
; CHECK: add <1 x i32>
; CHECK: add <8 x i32>
; CHECK: add <2 x i32>
; CHECK: add <1 x i32>
define <16 x i32> @test14(<16 x i32> %arg) {
%add = add <16 x i32> %arg, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
%and = and <16 x i32> %add, <i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
ret <16 x i32> %and
}
; NO SPLIT FOR HALF
; CHECK-LABEL: @test15
; CHECK: fadd <16 x half>
define <16 x i16> @test15(<16 x half> %arg) {
%add = fadd <16 x half> %arg, <half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0, half 1.0>
%int = fptoui <16 x half> %add to <16 x i16>
%and = and <16 x i16> %int, <i16 1, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
ret <16 x i16> %and
}
; NO SPLIT FOR IEEE INTRINSICS
; CHECK-LABEL: @test16
; CHECK: call <16 x float> @llvm.genx.ieee.sqrt.v16f32
; CHECK-NEXT: call <16 x float> @llvm.genx.ieee.div.v16f32
define <16 x i16> @test16(<16 x float> %arg) {
%sqrt = call <16 x float> @llvm.genx.ieee.sqrt.v16f32(<16 x float> %arg)
%div = call <16 x float> @llvm.genx.ieee.div.v16f32(<16 x float> %arg, <16 x float> %sqrt)
%int = fptoui <16 x float> %div to <16 x i16>
%and = and <16 x i16> %int, <i16 1, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
ret <16 x i16> %and
}
|