@@ -120,3 +120,66 @@ void test_builtin_elementwise_exp(float f, double d, vfloat4 vf4,
120120 // LLVM: {{%.*}} = call <4 x double> @llvm.exp.v4f64(<4 x double> {{%.*}})
121121 vd4 = __builtin_elementwise_exp (vd4 );
122122}
123+
124+ void test_builtin_elementwise_log (float f , double d , vfloat4 vf4 ,
125+ vdouble4 vd4 ) {
126+ // CIR-LABEL: test_builtin_elementwise_log
127+ // LLVM-LABEL: test_builtin_elementwise_log
128+ // CIR: {{%.*}} = cir.log {{%.*}} : !cir.float
129+ // LLVM: {{%.*}} = call float @llvm.log.f32(float {{%.*}})
130+ f = __builtin_elementwise_log (f );
131+
132+ // CIR: {{%.*}} = cir.log {{%.*}} : !cir.double
133+ // LLVM: {{%.*}} = call double @llvm.log.f64(double {{%.*}})
134+ d = __builtin_elementwise_log (d );
135+
136+ // CIR: {{%.*}} = cir.log {{%.*}} : !cir.vector<!cir.float x 4>
137+ // LLVM: {{%.*}} = call <4 x float> @llvm.log.v4f32(<4 x float> {{%.*}})
138+ vf4 = __builtin_elementwise_log (vf4 );
139+
140+ // CIR: {{%.*}} = cir.log {{%.*}} : !cir.vector<!cir.double x 4>
141+ // LLVM: {{%.*}} = call <4 x double> @llvm.log.v4f64(<4 x double> {{%.*}})
142+ vd4 = __builtin_elementwise_log (vd4 );
143+ }
144+
145+ void test_builtin_elementwise_log2 (float f , double d , vfloat4 vf4 ,
146+ vdouble4 vd4 ) {
147+ // CIR-LABEL: test_builtin_elementwise_log2
148+ // LLVM-LABEL: test_builtin_elementwise_log2
149+ // CIR: {{%.*}} = cir.log2 {{%.*}} : !cir.float
150+ // LLVM: {{%.*}} = call float @llvm.log2.f32(float {{%.*}})
151+ f = __builtin_elementwise_log2 (f );
152+
153+ // CIR: {{%.*}} = cir.log2 {{%.*}} : !cir.double
154+ // LLVM: {{%.*}} = call double @llvm.log2.f64(double {{%.*}})
155+ d = __builtin_elementwise_log2 (d );
156+
157+ // CIR: {{%.*}} = cir.log2 {{%.*}} : !cir.vector<!cir.float x 4>
158+ // LLVM: {{%.*}} = call <4 x float> @llvm.log2.v4f32(<4 x float> {{%.*}})
159+ vf4 = __builtin_elementwise_log2 (vf4 );
160+
161+ // CIR: {{%.*}} = cir.log2 {{%.*}} : !cir.vector<!cir.double x 4>
162+ // LLVM: {{%.*}} = call <4 x double> @llvm.log2.v4f64(<4 x double> {{%.*}})
163+ vd4 = __builtin_elementwise_log2 (vd4 );
164+ }
165+
166+ void test_builtin_elementwise_log10 (float f , double d , vfloat4 vf4 ,
167+ vdouble4 vd4 ) {
168+ // CIR-LABEL: test_builtin_elementwise_log10
169+ // LLVM-LABEL: test_builtin_elementwise_log10
170+ // CIR: {{%.*}} = cir.log10 {{%.*}} : !cir.float
171+ // LLVM: {{%.*}} = call float @llvm.log10.f32(float {{%.*}})
172+ f = __builtin_elementwise_log10 (f );
173+
174+ // CIR: {{%.*}} = cir.log10 {{%.*}} : !cir.double
175+ // LLVM: {{%.*}} = call double @llvm.log10.f64(double {{%.*}})
176+ d = __builtin_elementwise_log10 (d );
177+
178+ // CIR: {{%.*}} = cir.log10 {{%.*}} : !cir.vector<!cir.float x 4>
179+ // LLVM: {{%.*}} = call <4 x float> @llvm.log10.v4f32(<4 x float> {{%.*}})
180+ vf4 = __builtin_elementwise_log10 (vf4 );
181+
182+ // CIR: {{%.*}} = cir.log10 {{%.*}} : !cir.vector<!cir.double x 4>
183+ // LLVM: {{%.*}} = call <4 x double> @llvm.log10.v4f64(<4 x double> {{%.*}})
184+ vd4 = __builtin_elementwise_log10 (vd4 );
185+ }
0 commit comments