Skip to content

Commit 3e606a7

Browse files
committed
Fixups
1 parent 52ddf6e commit 3e606a7

File tree

3 files changed

+110
-4
lines changed

3 files changed

+110
-4
lines changed

llvm/docs/GlobalISel/GenericOpcode.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,8 @@ G_FCEIL, G_FSQRT, G_FFLOOR, G_FRINT, G_FNEARBYINT
633633

634634
These correspond to the standard C functions of the same name.
635635

636-
G_FCOS, G_FSIN, G_FTAN, G_FACOS, G_FASIN, G_FATAN, G_FATAN2, G_FCOSH, G_FSINH, G_FTANH
637-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
636+
G_FCOS, G_FSIN, G_FSINCOS, G_FTAN, G_FACOS, G_FASIN, G_FATAN, G_FATAN2, G_FCOSH, G_FSINH, G_FTANH
637+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
638638

639639
These correspond to the standard C trigonometry functions of the same name.
640640

llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5581,11 +5581,11 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
55815581
case ISD::FSINCOS: {
55825582
Tmp1 = DAG.getNode(ISD::FP_EXTEND, dl, NVT, Node->getOperand(0));
55835583
Tmp2 = DAG.getNode(ISD::FSINCOS, dl, {NVT, NVT}, Tmp1);
5584+
Tmp3 = DAG.getIntPtrConstant(0, dl, /*isTarget=*/true);
55845585

55855586
for (unsigned ResNum = 0; ResNum < Node->getNumValues(); ResNum++)
55865587
Results.push_back(
5587-
DAG.getNode(ISD::FP_ROUND, dl, OVT, Tmp2.getValue(ResNum),
5588-
DAG.getIntPtrConstant(0, dl, /*isTarget=*/true)));
5588+
DAG.getNode(ISD::FP_ROUND, dl, OVT, Tmp2.getValue(ResNum), Tmp3));
55895589
break;
55905590
}
55915591
case ISD::FFLOOR:
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2+
; RUN: llc -O0 -mtriple=aarch64-linux-gnu -global-isel -stop-after=irtranslator %s -o - | FileCheck %s
3+
4+
define { half, half } @test_sincos_f16(half %a) {
5+
; CHECK-LABEL: name: test_sincos_f16
6+
; CHECK: bb.1 (%ir-block.0):
7+
; CHECK-NEXT: liveins: $h0
8+
; CHECK-NEXT: {{ $}}
9+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY $h0
10+
; CHECK-NEXT: [[FSINCOS:%[0-9]+]]:_(s16), [[FSINCOS1:%[0-9]+]]:_ = G_FSINCOS [[COPY]]
11+
; CHECK-NEXT: $h0 = COPY [[FSINCOS]](s16)
12+
; CHECK-NEXT: $h1 = COPY [[FSINCOS1]](s16)
13+
; CHECK-NEXT: RET_ReallyLR implicit $h0, implicit $h1
14+
%result = call { half, half } @llvm.sincos.f16(half %a)
15+
ret { half, half } %result
16+
}
17+
18+
define { <2 x half>, <2 x half> } @test_sincos_v2f16(<2 x half> %a) {
19+
; CHECK-LABEL: name: test_sincos_v2f16
20+
; CHECK: bb.1 (%ir-block.0):
21+
; CHECK-NEXT: liveins: $d0
22+
; CHECK-NEXT: {{ $}}
23+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
24+
; CHECK-NEXT: [[UV:%[0-9]+]]:_(<2 x s16>), [[UV1:%[0-9]+]]:_(<2 x s16>) = G_UNMERGE_VALUES [[COPY]](<4 x s16>)
25+
; CHECK-NEXT: [[FSINCOS:%[0-9]+]]:_(<2 x s16>), [[FSINCOS1:%[0-9]+]]:_ = G_FSINCOS [[UV]]
26+
; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s16), [[UV3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[FSINCOS]](<2 x s16>)
27+
; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
28+
; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s16>) = G_BUILD_VECTOR [[UV2]](s16), [[UV3]](s16), [[DEF]](s16), [[DEF]](s16)
29+
; CHECK-NEXT: [[UV4:%[0-9]+]]:_(s16), [[UV5:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[FSINCOS1]](<2 x s16>)
30+
; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<4 x s16>) = G_BUILD_VECTOR [[UV4]](s16), [[UV5]](s16), [[DEF]](s16), [[DEF]](s16)
31+
; CHECK-NEXT: $d0 = COPY [[BUILD_VECTOR]](<4 x s16>)
32+
; CHECK-NEXT: $d1 = COPY [[BUILD_VECTOR1]](<4 x s16>)
33+
; CHECK-NEXT: RET_ReallyLR implicit $d0, implicit $d1
34+
%result = call { <2 x half>, <2 x half> } @llvm.sincos.v2f16(<2 x half> %a)
35+
ret { <2 x half>, <2 x half> } %result
36+
}
37+
38+
define { float, float } @test_sincos_f32(float %a) {
39+
; CHECK-LABEL: name: test_sincos_f32
40+
; CHECK: bb.1 (%ir-block.0):
41+
; CHECK-NEXT: liveins: $s0
42+
; CHECK-NEXT: {{ $}}
43+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $s0
44+
; CHECK-NEXT: [[FSINCOS:%[0-9]+]]:_(s32), [[FSINCOS1:%[0-9]+]]:_ = G_FSINCOS [[COPY]]
45+
; CHECK-NEXT: $s0 = COPY [[FSINCOS]](s32)
46+
; CHECK-NEXT: $s1 = COPY [[FSINCOS1]](s32)
47+
; CHECK-NEXT: RET_ReallyLR implicit $s0, implicit $s1
48+
%result = call { float, float } @llvm.sincos.f32(float %a)
49+
ret { float, float } %result
50+
}
51+
52+
define { <2 x float>, <2 x float> } @test_sincos_v2f32(<2 x float> %a) {
53+
; CHECK-LABEL: name: test_sincos_v2f32
54+
; CHECK: bb.1 (%ir-block.0):
55+
; CHECK-NEXT: liveins: $d0
56+
; CHECK-NEXT: {{ $}}
57+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
58+
; CHECK-NEXT: [[FSINCOS:%[0-9]+]]:_(<2 x s32>), [[FSINCOS1:%[0-9]+]]:_ = G_FSINCOS [[COPY]]
59+
; CHECK-NEXT: $d0 = COPY [[FSINCOS]](<2 x s32>)
60+
; CHECK-NEXT: $d1 = COPY [[FSINCOS1]](<2 x s32>)
61+
; CHECK-NEXT: RET_ReallyLR implicit $d0, implicit $d1
62+
%result = call { <2 x float>, <2 x float> } @llvm.sincos.v2f32(<2 x float> %a)
63+
ret { <2 x float>, <2 x float> } %result
64+
}
65+
66+
define { double, double } @test_sincos_f64(double %a) {
67+
; CHECK-LABEL: name: test_sincos_f64
68+
; CHECK: bb.1 (%ir-block.0):
69+
; CHECK-NEXT: liveins: $d0
70+
; CHECK-NEXT: {{ $}}
71+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d0
72+
; CHECK-NEXT: [[FSINCOS:%[0-9]+]]:_(s64), [[FSINCOS1:%[0-9]+]]:_ = G_FSINCOS [[COPY]]
73+
; CHECK-NEXT: $d0 = COPY [[FSINCOS]](s64)
74+
; CHECK-NEXT: $d1 = COPY [[FSINCOS1]](s64)
75+
; CHECK-NEXT: RET_ReallyLR implicit $d0, implicit $d1
76+
%result = call { double, double } @llvm.sincos.f64(double %a)
77+
ret { double, double } %result
78+
}
79+
80+
define { <2 x double>, <2 x double> } @test_sincos_v2f64(<2 x double> %a) {
81+
; CHECK-LABEL: name: test_sincos_v2f64
82+
; CHECK: bb.1 (%ir-block.0):
83+
; CHECK-NEXT: liveins: $q0
84+
; CHECK-NEXT: {{ $}}
85+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
86+
; CHECK-NEXT: [[FSINCOS:%[0-9]+]]:_(<2 x s64>), [[FSINCOS1:%[0-9]+]]:_ = G_FSINCOS [[COPY]]
87+
; CHECK-NEXT: $q0 = COPY [[FSINCOS]](<2 x s64>)
88+
; CHECK-NEXT: $q1 = COPY [[FSINCOS1]](<2 x s64>)
89+
; CHECK-NEXT: RET_ReallyLR implicit $q0, implicit $q1
90+
%result = call { <2 x double>, <2 x double> } @llvm.sincos.v2f64(<2 x double> %a)
91+
ret { <2 x double>, <2 x double> } %result
92+
}
93+
94+
define { fp128, fp128 } @test_sincos_f128(fp128 %a) {
95+
; CHECK-LABEL: name: test_sincos_f128
96+
; CHECK: bb.1 (%ir-block.0):
97+
; CHECK-NEXT: liveins: $q0
98+
; CHECK-NEXT: {{ $}}
99+
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
100+
; CHECK-NEXT: [[FSINCOS:%[0-9]+]]:_(s128), [[FSINCOS1:%[0-9]+]]:_ = G_FSINCOS [[COPY]]
101+
; CHECK-NEXT: $q0 = COPY [[FSINCOS]](s128)
102+
; CHECK-NEXT: $q1 = COPY [[FSINCOS1]](s128)
103+
; CHECK-NEXT: RET_ReallyLR implicit $q0, implicit $q1
104+
%result = call { fp128, fp128 } @llvm.sincos.f16(fp128 %a)
105+
ret { fp128, fp128 } %result
106+
}

0 commit comments

Comments
 (0)