File: basic-regkey-EnableConstIntDivReduction-eq-2.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 (67 lines) | stat: -rw-r--r-- 3,077 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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; REQUIRES: regkeys
; RUN: igc_opt -igc-intdiv-red --regkey=EnableConstIntDivReduction=2 -S < %s | FileCheck %s
; ------------------------------------------------
; IntDivConstantReduction
; ------------------------------------------------


define spir_kernel void @test_srem_9(i64 %src1) {
; CHECK-LABEL: @test_srem_9(
; CHECK-NEXT:    [[TMP1:%.*]] = icmp sge i64 [[SRC1:%.*]], -2147483648
; CHECK-NEXT:    [[TMP2:%.*]] = icmp sle i64 [[SRC1]], 2147483647
; CHECK-NEXT:    [[TMP3:%.*]] = and i1 [[TMP1]], [[TMP2]]
; CHECK-NEXT:    br i1 [[TMP3]], label [[SDIV_POW2_64B_AS_32B:%.*]], label [[SDIV_POW2_64B:%.*]]
; CHECK:       sdiv_pow2_64b_as_32b:
; CHECK-NEXT:    [[TMP4:%.*]] = trunc i64 [[SRC1]] to i32
; CHECK-NEXT:    [[Q_APPX:%.*]] = call i32 @llvm.genx.GenISA.imulH.i32(i32 [[TMP4]], i32 954437177)
; CHECK-NEXT:    [[Q_APPX1:%.*]] = ashr i32 [[Q_APPX]], 1
; CHECK-NEXT:    [[TMP5:%.*]] = icmp slt i32 [[Q_APPX1]], 0
; CHECK-NEXT:    [[TMP6:%.*]] = select i1 [[TMP5]], i32 1, i32 0
; CHECK-NEXT:    [[TMP7:%.*]] = add i32 [[Q_APPX1]], [[TMP6]]
; CHECK-NEXT:    [[Q_TIMES_D:%.*]] = mul i32 [[TMP7]], 9
; CHECK-NEXT:    [[REM:%.*]] = sub i32 [[TMP4]], [[Q_TIMES_D]]
; CHECK-NEXT:    [[TMP8:%.*]] = sext i32 [[REM]] to i64
; CHECK-NEXT:    br label [[TMP16:%.*]]
; CHECK:       sdiv_pow2_64b:
; CHECK-NEXT:    [[U_LO32:%.*]] = and i64 [[SRC1]], 4294967295
; CHECK-NEXT:    [[U_HI32:%.*]] = ashr i64 [[SRC1]], 32
; CHECK-NEXT:    [[W0:%.*]] = mul i64 [[U_LO32]], 1908874354
; CHECK-NEXT:    [[TMP9:%.*]] = mul i64 [[U_HI32]], 1908874354
; CHECK-NEXT:    [[W0_LO32:%.*]] = lshr i64 [[W0]], 32
; CHECK-NEXT:    [[T:%.*]] = add i64 [[TMP9]], [[W0_LO32]]
; CHECK-NEXT:    [[TMP10:%.*]] = mul i64 [[U_LO32]], 477218588
; CHECK-NEXT:    [[T_LO32:%.*]] = and i64 [[T]], 4294967295
; CHECK-NEXT:    [[W1:%.*]] = add i64 [[TMP10]], [[T_LO32]]
; CHECK-NEXT:    [[TMP11:%.*]] = mul i64 [[U_HI32]], 477218588
; CHECK-NEXT:    [[T_HI32:%.*]] = ashr i64 [[T]], 32
; CHECK-NEXT:    [[TMP12:%.*]] = add i64 [[TMP11]], [[T_HI32]]
; CHECK-NEXT:    [[W1_LO32:%.*]] = ashr i64 [[W1]], 32
; CHECK-NEXT:    [[UV:%.*]] = add i64 [[TMP12]], [[W1_LO32]]
; CHECK-NEXT:    [[TMP13:%.*]] = icmp slt i64 [[UV]], 0
; CHECK-NEXT:    [[TMP14:%.*]] = select i1 [[TMP13]], i64 1, i64 0
; CHECK-NEXT:    [[TMP15:%.*]] = add i64 [[UV]], [[TMP14]]
; CHECK-NEXT:    [[Q_TIMES_D2:%.*]] = mul i64 [[TMP15]], 9
; CHECK-NEXT:    [[REM3:%.*]] = sub i64 [[SRC1]], [[Q_TIMES_D2]]
; CHECK-NEXT:    br label [[TMP16]]
; CHECK:       16:
; CHECK-NEXT:    [[TMP17:%.*]] = phi i64 [ [[TMP8]], [[SDIV_POW2_64B_AS_32B]] ], [ [[REM3]], [[SDIV_POW2_64B]] ]
; CHECK-NEXT:    call void @use.i64(i64 [[TMP17]])
; CHECK-NEXT:    ret void
;
  %1 = srem i64 %src1, 9
  call void @use.i64(i64 %1)
  ret void
}

declare void @use.i16(i16)
declare void @use.i32(i32)
declare void @use.i64(i64)