File: bitcast-dst-pattern1.ll

package info (click to toggle)
intel-graphics-compiler2 2.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 106,644 kB
  • sloc: cpp: 805,640; lisp: 287,672; ansic: 16,414; python: 3,952; yacc: 2,588; lex: 1,666; pascal: 313; sh: 186; makefile: 35
file content (101 lines) | stat: -rw-r--r-- 2,976 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
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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; RUN: igc_opt -igc-legalization -S -dce < %s | FileCheck %s
; ------------------------------------------------
; Legalization: bitcast to illegal type
; ------------------------------------------------

; Checks legalization of these patterns:
;
; 1.
; %a = bitcast <3 x half> %src to i48
; %trunc = trunc i48 %a to i16
; %bitcast = bitcast i16 %trunc to half
;
; into
;
; %bitcast = extract <3 x half> %src, i32 0
;
; 2.
; %a = bitcast <3 x half> %src to i48
; %b = lshr i48 %a, 16
; %trunc = trunc i48 %b to i16
; %bitcast = bitcast i16 %trunc to half
;
; into
;
; %bitcast = extract <3 x half> %src, i32 1

define i16 @test_bitcast_pattern1(<5 x i16> %src1) {
; CHECK-LABEL: define i16 @test_bitcast_pattern1(
; CHECK-SAME: <5 x i16> [[SRC1:%.*]]) {
; CHECK:    [[TMP1:%.*]] = extractelement <5 x i16> [[SRC1]], i32 0
; CHECK:    ret i16 [[TMP1]]
;
  %1 = bitcast <5 x i16> %src1 to i80
  %2 = trunc i80 %1 to i16
  ret i16 %2
}

define i16 @test_bitcast_pattern1_lshr(<5 x i16> %src1) {
; CHECK-LABEL: define i16 @test_bitcast_pattern1_lshr(
; CHECK-SAME: <5 x i16> [[SRC1:%.*]]) {
; CHECK:    [[TMP1:%.*]] = extractelement <5 x i16> [[SRC1]], i32 2
; CHECK:    ret i16 [[TMP1]]
;
  %1 = bitcast <5 x i16> %src1 to i80
  %2 = lshr i80 %1, 32
  %3 = trunc i80 %2 to i16
  ret i16 %3
}

define i16 @test_bitcast_pattern1_half(<5 x half> %src1) {
; CHECK-LABEL: define i16 @test_bitcast_pattern1_half(
; CHECK-SAME: <5 x half> [[SRC1:%.*]]) {
; CHECK:    [[TMP1:%.*]] = extractelement <5 x half> [[SRC1]], i32 0
; CHECK:    [[TMP2:%.*]] = bitcast half [[TMP1]] to i16
; CHECK:    ret i16 [[TMP2]]
;
  %1 = bitcast <5 x half> %src1 to i80
  %2 = trunc i80 %1 to i16
  ret i16 %2
}

define i1 @test_bitcast_pattern1_lshr_i1(<4 x i1> %src1) {
; CHECK-LABEL: define i1 @test_bitcast_pattern1_lshr_i1(
; CHECK-SAME: <4 x i1> [[SRC1:%.*]]) {
; CHECK:    [[TMP1:%.*]] = extractelement <4 x i1> [[SRC1]], i32 1
; CHECK:    ret i1 [[TMP1]]
;
  %1 = bitcast <4 x i1> %src1 to i4
  %2 = lshr i4 %1, 1
  %3 = trunc i4 %2 to i1
  ret i1 %3
}

define half @test_bitcast_pattern1_cast(<5 x half> %src1) {
; CHECK-LABEL: define half @test_bitcast_pattern1_cast(
; CHECK-SAME: <5 x half> [[SRC1:%.*]]) {
; CHECK:    [[TMP1:%.*]] = extractelement <5 x half> [[SRC1]], i32 0
; CHECK:    ret half [[TMP1]]
;
  %1 = bitcast <5 x half> %src1 to i80
  %2 = trunc i80 %1 to i16
  %3 = bitcast i16 %2 to half
  ret half %3
}

!igc.functions = !{!0, !1, !2, !3, !4}

!0 = !{i16 (<5 x i16>)* @test_bitcast_pattern1, !5}
!1 = !{i16 (<5 x i16>)* @test_bitcast_pattern1_lshr, !5}
!2 = !{i16 (<5 x half>)* @test_bitcast_pattern1_half, !5}
!3 = !{i1 (<4 x i1>)* @test_bitcast_pattern1_lshr_i1, !5}
!4 = !{half (<5 x half>)* @test_bitcast_pattern1_cast, !5}
!5 = !{}