File: intrinsics-trunc-f64.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 (65 lines) | stat: -rw-r--r-- 2,820 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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; RUN: igc_opt -igc-legalization -S -dce < %s | FileCheck %s
; ------------------------------------------------
; Legalization: intrinsics
; ------------------------------------------------

; Checks legalization of trunc intrinsic
; for double type

define double @test_trunc(double %s1) {
; CHECK-LABEL: define double @test_trunc(
; CHECK-SAME: double [[S1:%.*]]) {
; CHECK:    [[TMP1:%.*]] = bitcast double [[S1]] to i64
; CHECK:    [[TMP2:%.*]] = lshr i64 [[TMP1]], 32
; CHECK:    [[TMP32:%.*]] = trunc i64 [[TMP2]] to i32
; CHECK:    [[TMP4:%.*]] = lshr i64 [[TMP1]], 52
; CHECK:    [[TMP5:%.*]] = trunc i64 [[TMP4]] to i32
; CHECK:    [[TMP6:%.*]] = and i32 [[TMP5]], 2047
; CHECK:    [[TMP7:%.*]] = sub nsw i32 1023, [[TMP6]]
; CHECK:    [[TMP8:%.*]] = add nsw i32 [[TMP7]], 52
; CHECK:    [[TMP9:%.*]] = add nsw i32 [[TMP7]], 20
; CHECK:    [[TMP10:%.*]] = icmp sgt i32 [[TMP8]], 32
; CHECK:    [[TMP11:%.*]] = select i1 [[TMP10]], i32 32, i32 [[TMP8]]
; CHECK:    [[TMP12:%.*]] = icmp sgt i32 [[TMP9]], 20
; CHECK:    [[TMP13:%.*]] = select i1 [[TMP12]], i32 20, i32 [[TMP9]]
; CHECK:    [[TMP14:%.*]] = icmp sgt i32 [[TMP11]], 0
; CHECK:    [[TMP15:%.*]] = select i1 [[TMP14]], i32 [[TMP11]], i32 0
; CHECK:    [[TMP16:%.*]] = icmp sgt i32 [[TMP13]], 0
; CHECK:    [[TMP17:%.*]] = select i1 [[TMP16]], i32 [[TMP13]], i32 0
; CHECK:    [[TMP18:%.*]] = and i32 [[TMP15]], 31
; CHECK:    [[TMP19:%.*]] = shl i32 -1, [[TMP18]]
; CHECK:    [[TMP20:%.*]] = and i32 [[TMP17]], 31
; CHECK:    [[TMP21:%.*]] = shl i32 -1, [[TMP20]]
; CHECK:    [[TMP22:%.*]] = icmp ne i32 [[TMP15]], 32
; CHECK:    [[TMP23:%.*]] = select i1 [[TMP22]], i32 [[TMP19]], i32 0
; CHECK:    [[TMP24:%.*]] = icmp ult i32 [[TMP6]], 1023
; CHECK:    [[MASKVALHIGH32BIT_0_I:%.*]] = select i1 [[TMP24]], i32 -2147483648, i32 [[TMP21]]
; CHECK:    [[MASKVALLOW32BIT_0_I:%.*]] = select i1 [[TMP24]], i32 0, i32 [[TMP23]]
; CHECK:    [[TMP25:%.*]] = trunc i64 [[TMP1]] to i32
; CHECK:    [[TMP26:%.*]] = and i32 [[MASKVALLOW32BIT_0_I]], [[TMP25]]
; CHECK:    [[TMP27:%.*]] = and i32 [[MASKVALHIGH32BIT_0_I]], [[TMP32]]
; CHECK:    [[TMP28:%.*]] = zext i32 [[TMP27]] to i64
; CHECK:    [[TMP29:%.*]] = shl nuw i64 [[TMP28]], 32
; CHECK:    [[TMP30:%.*]] = zext i32 [[TMP26]] to i64
; CHECK:    [[TMP31:%.*]] = or i64 [[TMP29]], [[TMP30]]
; CHECK:    [[TMP3:%.*]] = bitcast i64 [[TMP31]] to double
; CHECK:    ret double [[TMP3]]
;
  %1 = call double @llvm.trunc.f64(double %s1)
  ret double %1
}

declare double @llvm.trunc.f64(double)

!igc.functions = !{!0}

!0 = !{double (double)* @test_trunc, !1}
!1 = !{}