File: mulh.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 (73 lines) | stat: -rw-r--r-- 3,034 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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; RUN: igc_opt -platformdg2 -igc-legalization -S < %s | FileCheck %s
; ------------------------------------------------
; Legalization: Call GenISA.imulH and GenISA.umulH intrinsics
; ------------------------------------------------
;
; Pass checks that GenISA.imulH and GenISA.umulH are legalized
; for platforms without 64 mul support.

define i64 @test_imulh(i64 %src1, i64 %src2) {
; CHECK-LABEL: define i64 @test_imulh(
; CHECK-SAME: i64 [[SRC1:%.*]], i64 [[SRC2:%.*]]) {
; CHECK:    [[U_LO32:%.*]] = and i64 [[SRC1]], 4294967295
; CHECK:    [[U_HI32:%.*]] = ashr i64 [[SRC1]], 32
; CHECK:    [[V_LO32:%.*]] = and i64 [[SRC2]], 4294967295
; CHECK:    [[V_HI32:%.*]] = ashr i64 [[SRC2]], 32
; CHECK:    [[W0:%.*]] = mul i64 [[U_LO32]], [[V_LO32]]
; CHECK:    [[TMP1:%.*]] = mul i64 [[U_HI32]], [[V_LO32]]
; CHECK:    [[W0_LO32:%.*]] = lshr i64 [[W0]], 32
; CHECK:    [[T:%.*]] = add i64 [[TMP1]], [[W0_LO32]]
; CHECK:    [[TMP2:%.*]] = mul i64 [[U_LO32]], [[V_HI32]]
; CHECK:    [[T_LO32:%.*]] = and i64 [[T]], 4294967295
; CHECK:    [[W1:%.*]] = add i64 [[TMP2]], [[T_LO32]]
; CHECK:    [[TMP3:%.*]] = mul i64 [[U_HI32]], [[V_HI32]]
; CHECK:    [[T_HI32:%.*]] = ashr i64 [[T]], 32
; CHECK:    [[TMP4:%.*]] = add i64 [[TMP3]], [[T_HI32]]
; CHECK:    [[W1_LO32:%.*]] = ashr i64 [[W1]], 32
; CHECK:    [[UV:%.*]] = add i64 [[TMP4]], [[W1_LO32]]
; CHECK:    ret i64 [[UV]]
;
  %1 = call i64 @llvm.genx.GenISA.imulH.i64(i64 %src1, i64 %src2)
  ret i64 %1
}

define i64 @test_umulh(i64 %src1, i64 %src2) {
; CHECK-LABEL: define i64 @test_umulh(
; CHECK-SAME: i64 [[SRC1:%.*]], i64 [[SRC2:%.*]]) {
; CHECK:    [[U_LO32:%.*]] = and i64 [[SRC1]], 4294967295
; CHECK:    [[U_HI32:%.*]] = lshr i64 [[SRC1]], 32
; CHECK:    [[V_LO32:%.*]] = and i64 [[SRC2]], 4294967295
; CHECK:    [[V_HI32:%.*]] = lshr i64 [[SRC2]], 32
; CHECK:    [[W0:%.*]] = mul i64 [[U_LO32]], [[V_LO32]]
; CHECK:    [[TMP1:%.*]] = mul i64 [[U_HI32]], [[V_LO32]]
; CHECK:    [[W0_LO32:%.*]] = lshr i64 [[W0]], 32
; CHECK:    [[T:%.*]] = add i64 [[TMP1]], [[W0_LO32]]
; CHECK:    [[TMP2:%.*]] = mul i64 [[U_LO32]], [[V_HI32]]
; CHECK:    [[T_LO32:%.*]] = and i64 [[T]], 4294967295
; CHECK:    [[W1:%.*]] = add i64 [[TMP2]], [[T_LO32]]
; CHECK:    [[TMP3:%.*]] = mul i64 [[U_HI32]], [[V_HI32]]
; CHECK:    [[T_HI32:%.*]] = lshr i64 [[T]], 32
; CHECK:    [[TMP4:%.*]] = add i64 [[TMP3]], [[T_HI32]]
; CHECK:    [[W1_LO32:%.*]] = lshr i64 [[W1]], 32
; CHECK:    [[UV:%.*]] = add i64 [[TMP4]], [[W1_LO32]]
; CHECK:    ret i64 [[UV]]
;
  %1 = call i64 @llvm.genx.GenISA.umulH.i64(i64 %src1, i64 %src2)
  ret i64 %1
}

declare i64 @llvm.genx.GenISA.imulH.i64(i64, i64)
declare i64 @llvm.genx.GenISA.umulH.i64(i64, i64)

!igc.functions = !{!0, !1}
!0 = !{i64 (i64, i64)* @test_imulh, !2}
!1 = !{i64 (i64, i64)* @test_umulh, !2}
!2 = !{}