File: zext.ll

package info (click to toggle)
intel-graphics-compiler 1.0.12504.6-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 83,912 kB
  • sloc: cpp: 910,147; lisp: 202,655; ansic: 15,197; python: 4,025; yacc: 2,241; lex: 1,570; pascal: 244; sh: 104; makefile: 25
file content (59 lines) | stat: -rw-r--r-- 1,831 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
57
58
59
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; RUN: igc_opt -debugify --igc-gen-specific-pattern -check-debugify -S < %s 2>&1 | FileCheck %s
; ------------------------------------------------
; GenSpecificPattern: zext, trunc patterns
; ------------------------------------------------

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

define spir_kernel void @test_zext_i1(i32 %src1) {
; CHECK-LABEL: @test_zext_i1(
; CHECK:    [[TMP1:%[A-z0-9]*]] = icmp slt i32 [[SRC1:%[A-z0-9]*]], 2
; CHECK:    [[TMP2:%[A-z0-9]*]] = sext i1 [[TMP1]] to i32
; CHECK:    [[TMP3:%[A-z0-9]*]] = sub i32 0, [[TMP2]]
; CHECK:    call void @use.i32(i32 [[TMP3]])
; CHECK:    ret void
;
  %1 = icmp slt i32 %src1, 2
  %2 = zext i1 %1 to i32
  call void @use.i32(i32 %2)
  ret void
}

define spir_kernel void @test_zext_ptr(i32 %src1) {
; CHECK-LABEL: @test_zext_ptr(
; CHECK:    [[TMP1:%[A-z0-9]*]] = inttoptr i32 [[SRC1:%[A-z0-9]*]] to i64*
; CHECK:    call void @use.p64(i64* [[TMP1]])
; CHECK:    ret void
;
  %1 = zext i32 %src1 to i64
  %2 = inttoptr i64 %1 to i64*
  call void @use.p64(i64* %2)
  ret void
}

define spir_kernel void @test_trunc(i64 %src1) {
; CHECK-LABEL: @test_trunc(
; CHECK:    [[TMP1:%[A-z0-9]*]] = bitcast i64 [[SRC1:%[A-z0-9]*]] to <2 x i32>
; CHECK:    [[TMP2:%[A-z0-9]*]] = extractelement <2 x i32> [[TMP1]], i32 1
; CHECK:    [[TMP3:%[A-z0-9]*]] = lshr i32 [[TMP2]], 17
; CHECK:    call void @use.i32(i32 [[TMP3]])
; CHECK:    ret void
;
  %1 = lshr i64 %src1, 49
  %2 = trunc i64 %1 to i32
  call void @use.i32(i32 %2)
  ret void
}

declare void @use.i32(i32)
declare void @use.p64(i64*)