File: select.ll

package info (click to toggle)
intel-graphics-compiler 1.0.17791.18-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 102,312 kB
  • sloc: cpp: 935,343; lisp: 286,143; ansic: 16,196; python: 3,279; yacc: 2,487; lex: 1,642; pascal: 300; sh: 174; makefile: 27
file content (71 lines) | stat: -rw-r--r-- 4,333 bytes parent folder | download
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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2021 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================

; RUN: %opt %use_old_pass_manager% -GenXAggregatePseudoLowering -march=genx64 -mcpu=Gen9 -S < %s | FileCheck %s

%vec3_t = type { <16 x float>, <16 x float>, <16 x float> }
%folded_st = type { <16 x float>, { <16 x float>, <16 x float> } }

define dllexport void @simple_select(i1 %sel.cond, <16 x float> %sel.true.a, <16 x float> %sel.true.b, <16 x float> %sel.true.c, <16 x float> %sel.false.a, <16 x float> %sel.false.b, <16 x float> %sel.false.c) {
; CHECK-LABEL: simple_select

  %sel.true.0 = insertvalue %vec3_t undef, <16 x float> %sel.true.a, 0
  %sel.true.1 = insertvalue %vec3_t %sel.true.0, <16 x float> %sel.true.b, 1
  %sel.true = insertvalue %vec3_t %sel.true.1, <16 x float> %sel.true.c, 2
  %sel.false.0 = insertvalue %vec3_t undef, <16 x float> %sel.false.a, 0
  %sel.false.1 = insertvalue %vec3_t %sel.false.0, <16 x float> %sel.false.b, 1
  %sel.false = insertvalue %vec3_t %sel.false.1, <16 x float> %sel.false.c, 2

; COM: operand linearization
; CHECK: %[[SEL_TRUE_A:[^ ]+]] = extractvalue %vec3_t %sel.true, 0
; CHECK: %[[SEL_TRUE_B:[^ ]+]] = extractvalue %vec3_t %sel.true, 1
; CHECK: %[[SEL_TRUE_C:[^ ]+]] = extractvalue %vec3_t %sel.true, 2
; CHECK: %[[SEL_FALSE_A:[^ ]+]] = extractvalue %vec3_t %sel.false, 0
; CHECK: %[[SEL_FALSE_B:[^ ]+]] = extractvalue %vec3_t %sel.false, 1
; CHECK: %[[SEL_FALSE_C:[^ ]+]] = extractvalue %vec3_t %sel.false, 2
  %res = select i1 %sel.cond, %vec3_t %sel.true, %vec3_t %sel.false
; COM: split instruction
; CHECK: %[[SEL_RES_A:[^ ]+]] = select i1 %sel.cond, <16 x float> %[[SEL_TRUE_A]], <16 x float> %[[SEL_FALSE_A]]
; CHECK: %[[SEL_RES_B:[^ ]+]] = select i1 %sel.cond, <16 x float> %[[SEL_TRUE_B]], <16 x float> %[[SEL_FALSE_B]]
; CHECK: %[[SEL_RES_C:[^ ]+]] = select i1 %sel.cond, <16 x float> %[[SEL_TRUE_C]], <16 x float> %[[SEL_FALSE_C]]
; COM: combine the aggregate back
; CHECK: %[[SEL_RES_0:[^ ]+]] = insertvalue %vec3_t undef, <16 x float> %[[SEL_RES_A]], 0
; CHECK: %[[SEL_RES_1:[^ ]+]] = insertvalue %vec3_t %[[SEL_RES_0]], <16 x float> %[[SEL_RES_B]], 1
; CHECK: %res = insertvalue %vec3_t %[[SEL_RES_1]], <16 x float> %[[SEL_RES_C]], 2
  ret void
}

define dllexport void @folded_select(i1 %sel.cond, <16 x float> %sel.true.a, <16 x float> %sel.true.b, <16 x float> %sel.true.c, <16 x float> %sel.false.a, <16 x float> %sel.false.b, <16 x float> %sel.false.c) {
; CHECK-LABEL: folded_select

  %sel.true.0 = insertvalue %folded_st undef, <16 x float> %sel.true.a, 0
  %sel.true.1 = insertvalue %folded_st %sel.true.0, <16 x float> %sel.true.b, 1, 0
  %sel.true = insertvalue %folded_st %sel.true.1, <16 x float> %sel.true.c, 1, 1
  %sel.false.0 = insertvalue %folded_st undef, <16 x float> %sel.false.a, 0
  %sel.false.1 = insertvalue %folded_st %sel.false.0, <16 x float> %sel.false.b, 1, 0
  %sel.false = insertvalue %folded_st %sel.false.1, <16 x float> %sel.false.c, 1, 1

; COM: operand linearization
; CHECK: %[[SEL_TRUE_A:[^ ]+]] = extractvalue %folded_st %sel.true, 0
; CHECK: %[[SEL_TRUE_B:[^ ]+]] = extractvalue %folded_st %sel.true, 1, 0
; CHECK: %[[SEL_TRUE_C:[^ ]+]] = extractvalue %folded_st %sel.true, 1, 1
; CHECK: %[[SEL_FALSE_A:[^ ]+]] = extractvalue %folded_st %sel.false, 0
; CHECK: %[[SEL_FALSE_B:[^ ]+]] = extractvalue %folded_st %sel.false, 1, 0
; CHECK: %[[SEL_FALSE_C:[^ ]+]] = extractvalue %folded_st %sel.false, 1, 1
  %res = select i1 %sel.cond, %folded_st %sel.true, %folded_st %sel.false
; COM: split instruction
; CHECK: %[[SEL_RES_A:[^ ]+]] = select i1 %sel.cond, <16 x float> %[[SEL_TRUE_A]], <16 x float> %[[SEL_FALSE_A]]
; CHECK: %[[SEL_RES_B:[^ ]+]] = select i1 %sel.cond, <16 x float> %[[SEL_TRUE_B]], <16 x float> %[[SEL_FALSE_B]]
; CHECK: %[[SEL_RES_C:[^ ]+]] = select i1 %sel.cond, <16 x float> %[[SEL_TRUE_C]], <16 x float> %[[SEL_FALSE_C]]
; COM: combine the aggregate back
; CHECK: %[[SEL_RES_0:[^ ]+]] = insertvalue %folded_st undef, <16 x float> %[[SEL_RES_A]], 0
; CHECK: %[[SEL_RES_1:[^ ]+]] = insertvalue %folded_st %[[SEL_RES_0]], <16 x float> %[[SEL_RES_B]], 1, 0
; CHECK: %res = insertvalue %folded_st %[[SEL_RES_1]], <16 x float> %[[SEL_RES_C]], 1, 1
  ret void
}