@@ -51,4 +51,94 @@ entry:
5151 ret double %fadd
5252}
5353
54+ ; Test multiple fpe.control bundles.
55+ ; CHECK-NEXT: Multiple fpe.control operand bundles
56+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.control"(metadata !"rtz"), "fpe.control"(metadata !"rtz") ]
57+ define double @f6 (double %a ) #0 {
58+ entry:
59+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.control" (metadata !"rtz" ), "fpe.control" (metadata !"rtz" ) ]
60+ ret double %ftrunc
61+ }
62+
63+ ; Test fpe.control bundle that has more than one operands.
64+ ; CHECK-NEXT: Expected exactly one fpe.control bundle operand
65+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.control"(metadata !"rtz", metadata !"rte") ]
66+ define double @f7 (double %a ) #0 {
67+ entry:
68+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.control" (metadata !"rtz" , metadata !"rte" ) ]
69+ ret double %ftrunc
70+ }
71+
72+ ; Test fpe.control bundle that has non-metadata operand.
73+ ; CHECK-NEXT: Value of fpe.control bundle operand must be a metadata
74+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.control"(i32 0) ]
75+ define double @f8 (double %a ) #0 {
76+ entry:
77+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.control" (i32 0 ) ]
78+ ret double %ftrunc
79+ }
80+
81+ ; Test fpe.control bundle that has non-string operand.
82+ ; CHECK-NEXT: Value of fpe.control bundle operand must be a string
83+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.control"(metadata i64 3) ]
84+ define double @f9 (double %a ) #0 {
85+ entry:
86+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.control" (metadata !{i64 3 }) ]
87+ ret double %ftrunc
88+ }
89+
90+ ; Test fpe.control bundle that specifies incorrect value.
91+ ; CHECK-NEXT: Value of fpe.control bundle operand is not a correct rounding mode
92+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.control"(metadata !"qqq") ]
93+ define double @f10 (double %a ) #0 {
94+ entry:
95+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.control" (metadata !"qqq" ) ]
96+ ret double %ftrunc
97+ }
98+
99+ ; Test multiple fpe.except bundles.
100+ ; CHECK-NEXT: Multiple fpe.except operand bundles
101+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.except"(metadata !"strict"), "fpe.except"(metadata !"strict") ]
102+ define double @f11 (double %a ) #0 {
103+ entry:
104+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.except" (metadata !"strict" ), "fpe.except" (metadata !"strict" ) ]
105+ ret double %ftrunc
106+ }
107+
108+ ; Test fpe.except bundle that has more than one operands.
109+ ; CHECK-NEXT: Expected exactly one fpe.except bundle operand
110+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.except"(metadata !"strict", metadata !"strict") ]
111+ define double @f12 (double %a ) #0 {
112+ entry:
113+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.except" (metadata !"strict" , metadata !"strict" ) ]
114+ ret double %ftrunc
115+ }
116+
117+ ; Test fpe.except bundle that has non-metadata operand.
118+ ; CHECK-NEXT: Value of fpe.except bundle operand must be a metadata
119+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.except"(i32 0) ]
120+ define double @f13 (double %a ) #0 {
121+ entry:
122+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.except" (i32 0 ) ]
123+ ret double %ftrunc
124+ }
125+
126+ ; Test fpe.except bundle that has non-string operand.
127+ ; CHECK-NEXT: Value of fpe.except bundle operand must be a string
128+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.except"(metadata i64 3) ]
129+ define double @f14 (double %a ) #0 {
130+ entry:
131+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.except" (metadata !{i64 3 }) ]
132+ ret double %ftrunc
133+ }
134+
135+ ; Test fpe.except bundle that specifies incorrect value.
136+ ; CHECK-NEXT: Value of fpe.except bundle operand is not a correct exception behavior
137+ ; CHECK-NEXT: %ftrunc = call double @llvm.trunc.f64(double %a) #{{[0-9]+}} [ "fpe.except"(metadata !"qqq") ]
138+ define double @f15 (double %a ) #0 {
139+ entry:
140+ %ftrunc = call double @llvm.trunc.f64 (double %a ) #0 [ "fpe.except" (metadata !"qqq" ) ]
141+ ret double %ftrunc
142+ }
143+
54144attributes #0 = { strictfp }
0 commit comments