<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div><br></div><div>Hi,<br></div><div id="Zm-_Id_-Sgn" data-zbluepencil-ignore="true" data-sigid="8290688000000011003"><div>Thanks to all folks that help me, but I'm still a little confused when running `llvm-project/llvm/utils/update_cc_test_checks.py` script. I didn't open a new thread but replied to you directly, hope you won't mind :-)<br></div><div><br></div><div>First of all, the file I want to update: `llvm-project/clang/test/CodeGen/builtins-elementwise-math.c`, has RUN command like: <br></div><div>`// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s`. <br></div><div>I found that I cannot generate `CHECKS` unless I remove `-triple x86_64-apple-darwin`. It even cleaned `CHECKS` it used to have. FYI, I'm running Ubuntu in my machine.<br></div><div><br></div><div>Another thing that bothers me is that though I successfully generate `CHECKS`, they are very wired...<br></div><div>I expect:<br></div><div>```<br></div></div><div>void test_builtin_elementwise_abs(float f1, float f2, double d1, double d2,<br></div><div>                                  float4 vf1, float4 vf2, si8 vi1, si8 vi2,<br></div><div>                                  long long int i1, long long int i2, short si) {<br></div><div>  // CHECK-LABEL: define void @test_builtin_elementwise_abs(<br></div><div>  // CHECK:      [[F1:%.+]] = load float, float* %f1.addr, align 4<br></div><div>  // CHECK-NEXT:  call float @llvm.fabs.f32(float [[F1]])<br></div><div>  f2 = __builtin_elementwise_abs(f1);<br></div><div><br></div><div>  // CHECK:      [[D1:%.+]] = load double, double* %d1.addr, align 8<br></div><div>  // CHECK-NEXT: call double @llvm.fabs.f64(double [[D1]])<br></div><div>  d2 = __builtin_elementwise_abs(d1);<br></div><div>...<br></div><div id="Zm-_Id_-Sgn" data-zbluepencil-ignore="true" data-sigid="8290688000000011003"><div>```<br></div><div>However, it was like:<br></div><div>```<br></div></div><div>// CHECK-NEXT:    [[CONV:%.*]] = sext i16 [[TMP8]] to i32<br></div><div>// CHECK-NEXT:    [[ELT_ABS8:%.*]] = call i32 @llvm.abs.i32(i32 [[CONV]], i1 false)<br></div><div>// CHECK-NEXT:    [[CONV9:%.*]] = trunc i32 [[ELT_ABS8]] to i16<br></div><div>// CHECK-NEXT:    store i16 [[CONV9]], i16* [[SI_ADDR]], align 2<br></div><div>// CHECK-NEXT:    ret void<br></div><div>//<br></div><div>void test_builtin_elementwise_abs(float f1, float f2, double d1, double d2,<br></div><div>                                  float4 vf1, float4 vf2, si8 vi1, si8 vi2,<br></div><div>                                  long long int i1, long long int i2, short si) {<br></div><div>  f2 = __builtin_elementwise_abs(f1);<br></div><div><br></div><div>  d2 = __builtin_elementwise_abs(d1);<br></div><div><br></div><div>  vf2 = __builtin_elementwise_abs(vf1);<br></div><div id="Zm-_Id_-Sgn" data-zbluepencil-ignore="true" data-sigid="8290688000000011003"><div><br></div><div>```<br></div><div><br></div><div>The comments are all above the function declaration, which is not what I want. <br></div><div>The command to update check result is :<br></div><div>```<br></div><div>python3 ~/dev/cpp-projects/llvm-project/llvm/utils/update_cc_test_checks.py --llvm-bin=/home/jun/dev/cpp-projects/llvm-project/build/bin CodeGen/builtins-elementwise-math.c<br></div><div>```<br></div><div><br></div><div>Best regards,<br></div><div>Jun Zhang<br></div></div><div class="zmail_extra_hr" style="border-top: 1px solid rgb(204, 204, 204); height: 0px; margin-top: 10px; margin-bottom: 10px; line-height: 0px;"><br></div><div class="zmail_extra" data-zbluepencil-ignore="true"><div><br></div><div id="Zm-_Id_-Sgn1">---- 在 星期四, 25 十一月 2021 19:02:48 +0800 <b>Diogo Sampaio <dsampaio@kalray.eu></b> 撰写 ----<br></div><div><br></div><blockquote style="margin: 0px;"><div><div style="font-family :  arial,  helvetica,  sans-serif; font-size :  12pt; color :  #000000;"><div><div style="font-family :  'arial',  'helvetica',  sans-serif; font-size :  12pt; color :  #000000;"><div>Hi,<br></div><div>see if this helps you tu understand the test it self: <a href="https://llvm.org/docs/CommandGuide/FileCheck.html" target="_blank">https://llvm.org/docs/CommandGuide/FileCheck.html</a><br></div><div>And once you have a C/C++ input test file with a RUN: command on it, the test commands to check the result usually can be generated with the llvm-project/llvm/utils/update_cc_test_checks.py script.<br></div><div>cheers<br></div><div><br></div><div><div><br></div><div style="font-size :  9pt; font-family :  'arial',  'helvetica',  sans-serif;"><span class="colour" style="color:rgb(20, 68, 68)"><span class="size" style="font-size:9pt"><b>Diogo Sampaio</b></span></span><br> <span class="colour" style="color:rgb(20, 68, 68)"><span class="size" style="font-size:9pt"><b>Senior Compiler Engineer • Kalray</b></span></span><br><span class="colour" style="color:rgb(17, 88, 143)"><span class="size" style="font-size:8pt"><u><a href="mailto:dsampaio@kalrayinc.com" target="_blank">dsampaio@kalrayinc.com</a></u> • <a href="https://www.kalrayinc.com" style="color :  #11588f;" target="_blank"><u>www.kalrayinc.com</u></a></span></span></div><div><br></div><table cellpadding="0px" border="0px"><tbody><tr><td><div><a href="https://www.kalrayinc.com" target="_blank"><img alt="Kalray logo" id="1637838177718100001_imgsrc_url_0"></a><br></div></td></tr></tbody></table><div><br></div><div><span class="colour" style="color:rgb(125, 182, 33)"><span class="font" style="font-family:"arial", "helvetica", sans-serif"><span class="size" style="font-size:8pt"><b>Please consider the environment before printing this e-mail.</b></span></span></span> <br></div><div><span class="colour" style="color:rgb(20, 68, 68)"><span class="font" style="font-family:"arial", "helvetica", sans-serif"><span class="size" style="font-size: 8pt; display: block; line-height: 100%;">This message contains information that may be privileged or confidential and is the property of Kalray S.A. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.<br></span></span></span></div><div><br></div></div><div><br></div><div><hr id="x_-715086990zwchr"><br></div><div><b>From: </b>"cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br><b>To: </b>"cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br><b>Sent: </b>Thursday, November 25, 2021 11:54:27 AM<br><b>Subject: </b>[cfe-dev] Question about Clang codegen tests<br></div><div><br></div><div><div style="font-family :  'verdana',  'arial',  'helvetica',  sans-serif; font-size :  10pt;"><div>Hello, everyone!<br></div><div><br></div><div>I'm a newcomer, and want to make some contributions to the LLVM community. Is here the right place to reach out for help? Please forgive me if I did things wrong, as I'm unfamiliar with the LLVM workflow :-) <br></div><div><br></div><div>So a few days ago I noticed an issue in the bugzilla: <a href="https://bugs.llvm.org/show_bug.cgi?id=52444" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=52444</a>, I thought it would be suitable for me to work on. But now I run into some problems:<br></div><div><br></div><div>* What is meaning of the capitalized words in tests comments?<br></div><div>For example,  in `llvm-project/clang/test/CodeGen/builtins-elementwise-math.c`:<br></div><div>```<br></div><div>// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s<br></div><div>// CHECK-LABEL: define void @test_builtin_elementwise_abs( <br></div><div>// CHECK:      [[F1:%.+]] = load float, float* %f1.addr, align 4 <br></div><div>// CHECK-NEXT:  call float @llvm.fabs.f32(float [[F1]])<br></div><div>```<br></div><div>What do `RUN`, `CHECK` mean? I can guess they are some test instructions, so I briefly look through the docs, but I can't find anything useful :-( I'm sorry but the docs are so much, it's hard to find something I actually don't know what is.<br></div><div><br></div><div>* How can I write my own test for codegen?<br></div><div>The actual code part is not that hard, problems came in when I want to write some tests. The fact is that I'm unfamiliar with LLVM IR, so I don't know how to write the expected output...<br></div><div><br></div><div>Thanks so much for people who offer me help!<br></div><div><br></div><div>Best regards,<br></div><div>Jun Zhang<br></div></div><div><br></div><p id="x_-715086990fb_identificator"><br></p><p><br></p><div><br></div><div>_______________________________________________<br></div><div>cfe-dev mailing list<br></div><div><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br></div><div><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br></div></div></div><div><br></div></div></div><div id="x_-715086990content_out_dsampaio_kalray.eu"><br></div></div></blockquote></div><div><br></div></div><br></body></html>