File: reduceptr.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 (71 lines) | stat: -rw-r--r-- 2,465 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
60
61
62
63
64
65
66
67
68
69
70
71
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; ------------------------------------------------
; RUN: igc_opt -debugify --igc-gep-lowering -check-debugify -S < %s 2>&1 | FileCheck %s
; ------------------------------------------------
; GEPLowering
; ------------------------------------------------

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

define spir_kernel void @test_gep1(i32 %iptr) {
; CHECK-LABEL: @test_gep1(
; CHECK:    [[TMP1:%.*]] = sext i32 [[IPTR:%.*]] to i64
; CHECK:    [[TMP2:%.*]] = add i64 [[TMP1]], 13
; CHECK:    [[PTR:%.*]] = inttoptr i32 [[IPTR]] to i64*
; CHECK:    [[TMP3:%.*]] = add i32 [[IPTR]], 13
; CHECK:    [[TMP4:%.*]] = shl i32 [[TMP3]], 3
; CHECK:    [[TMP5:%.*]] = add i32 [[IPTR]], [[TMP4]]
; CHECK:    [[TMP6:%.*]] = inttoptr i32 [[TMP5]] to i64*
; CHECK:    [[RES:%.*]] = load i64, i64* [[TMP6]]
; CHECK:    store i64 [[TMP1]], i64* [[TMP6]]
; CHECK:    ret void
;
  %1 = sext i32 %iptr to i64
  %2 = add i64 %1, 13
  %ptr = inttoptr i32 %iptr to i64*
  %gep = getelementptr inbounds i64, i64* %ptr, i64 %2
  %res = load i64, i64* %gep
  store i64 %1, i64* %gep
  ret void
}

define spir_kernel void @test_gep2(i32 %iptr) {
; CHECK-LABEL: @test_gep2(
; CHECK:    [[TMP1:%.*]] = add i32 [[IPTR:%.*]], 42
; CHECK:    [[TMP2:%.*]] = sext i32 [[TMP1]] to i64
; CHECK:    [[PTR:%.*]] = inttoptr i32 [[IPTR]] to i8 addrspace(2)*
; CHECK:    [[TMP3:%.*]] = ptrtoint i8 addrspace(2)* [[PTR]] to i64
; CHECK:    [[TMP4:%.*]] = add i32 0, [[IPTR]]
; CHECK:    [[TMP5:%.*]] = add i32 [[TMP4]], 42
; CHECK:    [[TMP6:%.*]] = sext i32 [[TMP5]] to i64
; CHECK:    [[TMP7:%.*]] = add i64 [[TMP3]], [[TMP6]]
; CHECK:    [[TMP8:%.*]] = inttoptr i64 [[TMP7]] to i8 addrspace(2)*
; CHECK:    [[RES:%.*]] = load i8, i8 addrspace(2)* [[TMP8]]
; CHECK:    ret void
;
  %1 = add i32 %iptr, 42
  %2 = sext i32 %1 to i64
  %ptr = inttoptr i32 %iptr to i8 addrspace(2)*
  %gep = getelementptr inbounds i8, i8 addrspace(2)* %ptr, i64 %2
  %res = load i8, i8 addrspace(2)* %gep
  ret void
}

attributes #0 = { nounwind readnone speculatable }

!igc.functions = !{!0, !4}

!0 = !{void (i32)* @test_gep1, !1}
!1 = !{!2, !3}
!2 = !{!"function_type", i32 0}
!3 = !{!"implicit_arg_desc"}
!4 = !{void (i32)* @test_gep2, !1}