File: rounding.ll

package info (click to toggle)
intel-graphics-compiler2 2.28.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792,744 kB
  • sloc: cpp: 5,761,745; ansic: 466,928; lisp: 312,143; python: 114,790; asm: 44,736; pascal: 10,930; sh: 8,033; perl: 7,914; ml: 3,625; awk: 3,523; yacc: 2,747; javascript: 2,667; lex: 1,898; f90: 1,028; cs: 573; xml: 474; makefile: 344; objc: 162
file content (72 lines) | stat: -rw-r--r-- 2,830 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
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022-2025 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================

; RUN: %opt %use_old_pass_manager% -GenXLowering -march=genx64 -mcpu=XeHPG -mtriple=spir64-unknown-unknown -S < %s | FileCheck %s

declare float @llvm.ceil.f32(float) #1
declare <4 x float> @llvm.ceil.v4f32(<4 x float>) #1
declare float @llvm.floor.f32(float) #1
declare <4 x float> @llvm.floor.v4f32(<4 x float>) #1
declare float @llvm.trunc.f32(float) #1
declare <4 x float> @llvm.trunc.v4f32(<4 x float>) #1

define spir_func float @ceil_scalar(float %src) {
  %res = tail call float @llvm.ceil.f32(float %src)
  ret float %res
}
; CHECK-LABEL: define spir_func float @ceil_scalar
; CHECK-SAME: (float %[[ARG1:[^ )]+]])
; CHECK: %[[RES1:[^ ]+]] = call float @llvm.genx.rndu.f32(float %[[ARG1]])
; CHECK-NEXT: ret float %[[RES1]]

define spir_func <4 x float> @ceil_vec(<4 x float> %src) {
  %res = tail call <4 x float> @llvm.ceil.v4f32(<4 x float> %src)
  ret <4 x float> %res
}
; CHECK-LABEL: define spir_func <4 x float> @ceil_vec
; CHECK-SAME: (<4 x float> %[[ARG2:[^ )]+]])
; CHECK: %[[RES2:[^ ]+]] = call <4 x float> @llvm.genx.rndu.v4f32(<4 x float> %[[ARG2]])
; CHECK-NEXT: ret <4 x float> %[[RES2]]

define spir_func float @floor_scalar(float %src) {
  %res = tail call float @llvm.floor.f32(float %src)
  ret float %res
}
; CHECK-LABEL: define spir_func float @floor_scalar
; CHECK-SAME: (float %[[ARG3:[^ )]+]])
; CHECK: %[[RES3:[^ ]+]] = call float @llvm.genx.rndd.f32(float %[[ARG3]])
; CHECK-NEXT: ret float %[[RES3]]

define spir_func <4 x float> @floor_vec(<4 x float> %src) {
  %res = tail call <4 x float> @llvm.floor.v4f32(<4 x float> %src)
  ret <4 x float> %res
}
; CHECK-LABEL: define spir_func <4 x float> @floor_vec
; CHECK-SAME: (<4 x float> %[[ARG4:[^ )]+]])
; CHECK: %[[RES4:[^ ]+]] = call <4 x float> @llvm.genx.rndd.v4f32(<4 x float> %[[ARG4]])
; CHECK-NEXT: ret <4 x float> %[[RES4]]

define spir_func float @trunc_scalar(float %src) {
  %res = tail call float @llvm.trunc.f32(float %src)
  ret float %res
}
; CHECK-LABEL: define spir_func float @trunc_scalar
; CHECK-SAME: (float %[[ARG5:[^ )]+]])
; CHECK: %[[RES5:[^ ]+]] = call float @llvm.genx.rndz.f32(float %[[ARG5]])
; CHECK-NEXT: ret float %[[RES5]]

define spir_func <4 x float> @trunc_vec(<4 x float> %src) {
  %res = tail call <4 x float> @llvm.trunc.v4f32(<4 x float> %src)
  ret <4 x float> %res
}
; CHECK-LABEL: define spir_func <4 x float> @trunc_vec
; CHECK-SAME: (<4 x float> %[[ARG6:[^ )]+]])
; CHECK: %[[RES6:[^ ]+]] = call <4 x float> @llvm.genx.rndz.v4f32(<4 x float> %[[ARG6]])
; CHECK-NEXT: ret <4 x float> %[[RES6]]

attributes #1 = { nounwind readnone speculatable willreturn }