File: freeze.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 (56 lines) | stat: -rw-r--r-- 1,686 bytes parent folder | download | duplicates (2)
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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2023-2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; RUN: igc_opt --opaque-pointers -enable-debugify --igc-promoteint8type -S < %s 2>&1 | FileCheck %s
; ------------------------------------------------
; PromoteInt8Type : Freeze
; ------------------------------------------------

; REQUIRES: llvm-14-plus

; Debug-info related check
; CHECK-NOT: WARNING
; CHECK: CheckModuleDebugify: PASS

; Please note that freeze instruction is only expected to be promoted to i16 type
; if its result is used by arithmetic operation.

define i8 @test_freeze(i8 %src1) {
; CHECK-LABEL: @test_freeze(
; CHECK-NOT: freeze i16
  %1 = freeze i8 %src1
  ret i8 %1
}

define i8 @test_freeze_used_by_arith_inst(i8 %src1) {
; CHECK-LABEL: @test_freeze_used_by_arith_inst(
; CHECK:    [[B2S:%.*]] = sext i8 %src1 to i16
; CHECK:    [[SHR:%.*]] = add i16 [[B2S]], 1
; CHECK:    [[FREEZE:%.*]] = freeze i16 [[SHR]]
; CHECK:    [[ADD:%.*]] = add i16 [[FREEZE]], 1
; CHECK:    [[TRUNC:%.*]] = trunc i16 [[ADD]] to i8
; CHECK:    ret i8 [[TRUNC]]
;
  %1 = add i8 %src1, 1
  %2 = freeze i8 %1
  %3 = add i8 %2, 1
  ret i8 %3
}

define i8 @test_freeze_not_used_by_arith_inst(i8 %src1) {
; CHECK-LABEL: @test_freeze_not_used_by_arith_inst(
; CHECK:    [[B2S:%.*]] = sext i8 %src1 to i16
; CHECK:    [[SHR:%.*]] = add i16 [[B2S]], 1
; CHECK:    [[TRUNC:%.*]] = trunc i16 [[SHR]] to i8
; CHECK:    [[FREEZE:%.*]] = freeze i8 [[TRUNC]]
; CHECK:    ret i8 [[FREEZE]]
;
  %1 = add i8 %src1, 1
  %2 = freeze i8 %1
  ret i8 %2
}