Skip to content

Commit 83317bf

Browse files
authored
[NFC][SYCL] Move llvm.fpbuiltin tests to Transforms (#16847)
This PR also adds a test that debug info is being reserved during transformation. Follow up for #16714 --------- Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 816529f commit 83317bf

9 files changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
; RUN: opt -fpbuiltin-fn-selection -S < %s | FileCheck %s
2+
3+
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
4+
target triple = "nvptx64-nvidia-cuda"
5+
6+
; CHECK-LABEL: @test_fdiv
7+
; CHECK: %{{.*}} = call float @llvm.nvvm.div.approx.f(float %{{.*}}, float %{{.*}}){{.*}}, !dbg ![[#Loc1:]]
8+
; CHECK: %{{.*}} = fdiv float %{{.*}}, %{{.*}}, !dbg ![[#Loc2:]]
9+
; CHECK-DAG: [[#Loc1]] = !DILocation(line: 4, column: 1, scope: ![[#]])
10+
; CHECK-DAG: [[#Loc2]] = !DILocation(line: 5, column: 1, scope: ![[#]])
11+
define void @test_fdiv(float %d1, <2 x float> %v2d1,
12+
float %d2, <2 x float> %v2d2) {
13+
entry:
14+
%t0 = call float @llvm.fpbuiltin.fdiv.f32(float %d1, float %d2) #0, !dbg !16
15+
%t1 = call float @llvm.fpbuiltin.fdiv.f32(float %d1, float %d2) #1, !dbg !17
16+
ret void
17+
}
18+
19+
declare float @llvm.fpbuiltin.fdiv.f32(float, float)
20+
21+
attributes #0 = { "fpbuiltin-max-error"="2.5" }
22+
attributes #1 = { "fpbuiltin-max-error"="0.5" }
23+
24+
!llvm.dbg.cu = !{!0}
25+
!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
26+
!llvm.ident = !{!9}
27+
28+
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 21.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
29+
!1 = !DIFile(filename: "example.c", directory: "/home")
30+
!2 = !{i32 7, !"Dwarf Version", i32 4}
31+
!3 = !{i32 2, !"Debug Info Version", i32 3}
32+
!4 = !{i32 1, !"wchar_size", i32 4}
33+
!5 = !{i32 8, !"PIC Level", i32 2}
34+
!6 = !{i32 7, !"PIE Level", i32 2}
35+
!7 = !{i32 7, !"uwtable", i32 2}
36+
!8 = !{i32 7, !"frame-pointer", i32 2}
37+
!9 = !{!"clang version 21.0.0git (https://github.com/llvm/llvm-project.git"}
38+
!10 = distinct !DISubprogram(name: "test_fdiv", scope: !11, file: !11, line: 3, type: !12, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !15)
39+
!11 = !DIFile(filename: "example.c", directory: "/home")
40+
!12 = !DISubroutineType(types: !13)
41+
!13 = !{null, !14, !14}
42+
!14 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
43+
!15 = !{}
44+
!16 = !DILocation(line: 4, column: 1, scope: !10)
45+
!17 = !DILocation(line: 5, column: 1, scope: !10)

0 commit comments

Comments
 (0)