File: fix-int-vec.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 (68 lines) | stat: -rw-r--r-- 2,601 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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; RUN: igc_opt -enable-debugify --igc-legalize-function-signatures -S < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,%LLVM_DEPENDENT_CHECK_PREFIX%
; ------------------------------------------------
; LegalizeFunctionSignatures
; ------------------------------------------------

; Test checks that arguments with int vector type are legalized

; Debug-info related checks
;
; For llvm 14 check-debugify treats missing debug location on argument truncation to legal type
; at the begining of BB as a warning, while on earlier llvm versions its treated as an error.
;
; CHECK-LLVM-14-PLUS: CheckModuleDebugify: PASS

define spir_kernel void @test_k(i32 %src) {
; CHECK-LABEL: @test_k(
; CHECK:    [[TMP1:%.*]] = zext i32 [[SRC:%.*]] to i48
; CHECK:    [[TMP2:%.*]] = insertelement <3 x i48> <i48 0, i48 42, i48 13>, i48 [[TMP1]], i32 0
; CHECK:    [[TMP3:%.*]] = zext <3 x i48> [[TMP2]] to <3 x i64>
; CHECK:    [[TMP4:%.*]] = call i32 @foo(<3 x i64> [[TMP3]])
; CHECK:    [[TMP5:%.*]] = alloca i32, align 4
; CHECK:    store i32 [[TMP4]], i32* [[TMP5]], align 4
; CHECK:    call void @bar(<3 x i48> [[TMP2]])
; CHECK:    ret void
;
  %1 = zext i32 %src to i48
  %2 = insertelement <3 x i48> <i48 0, i48 42, i48 13>, i48 %1, i32 0
  %3 = call i32 @foo(<3 x i48> %2)
  %4 = alloca i32, align 4
  store i32 %3, i32* %4, align 4
  call void @bar(<3 x i48> %2)
  ret void
}

define spir_func i32 @foo(<3 x i48> %src) {
; CHECK-LABEL: define spir_func i32 @foo(<3 x i64> %src)
; CHECK:    [[TMP1:%.*]] = trunc <3 x i64> [[SRC:%.*]] to <3 x i48>
; CHECK:    [[TMP2:%.*]] = alloca <3 x i48>, align 32
; CHECK:    store <3 x i48> [[TMP1]], <3 x i48>* [[TMP2]], align 32
; CHECK:    [[TMP3:%.*]] = load <3 x i48>, <3 x i48>* [[TMP2]], align 32
; CHECK:    [[TMP4:%.*]] = extractelement <3 x i48> [[TMP3]], i32 0
; CHECK:    [[TMP5:%.*]] = extractelement <3 x i48> [[TMP1]], i32 1
; CHECK:    [[TMP6:%.*]] = add i48 [[TMP4]], [[TMP5]]
; CHECK:    [[TMP7:%.*]] = trunc i48 [[TMP6]] to i32
; CHECK:    ret i32 [[TMP7]]
;
  %1 = alloca <3 x i48>, align 32
  store <3 x i48> %src, <3 x i48>* %1, align 32
  %2 = load <3 x i48>, <3 x i48>* %1, align 32
  %3 = extractelement <3 x i48> %2, i32 0
  %4 = extractelement <3 x i48> %src, i32 1
  %5 = add i48 %3, %4
  %6 = trunc i48 %5 to i32
  ret i32 %6
}

declare void @bar(<3 x i48>) #0


attributes #0 = { "IndirectlyCalled" }