<div dir="ltr"><div>Thank you. I get it. <br></div><div>I agree with your patch.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 August 2016 at 10:03, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">They are in fact both broken, i only mentioned the first one since they are almost the same.<br><br>The attached patch fixes both tests<div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 4, 2016 at 7:00 PM Jojo Ma <<a href="mailto:jojo.ma@linaro.org" target="_blank">jojo.ma@linaro.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Zachary,<div><br></div><div>Thank you very much!</div><div><span style="font-size:13px"><br></span></div><div>I'm a little confused. <span style="font-size:13px">ARMparseCPUArch is similar to AArch64parseCPUArch, if this is broken on your machine that should be also.</span></div><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">I would like to know why this does but that doesn't. Could </span><span> you help me to make a comparison on your local</span><span style="font-size:13px">? As this problem does't</span></div><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">happen ethier on my local or on any buildbots.</span></div><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">Thanks a lot! </span></div></div><div class="gmail_extra"></div><div class="gmail_extra"><br><div class="gmail_quote">On 5 August 2016 at 03:40, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have fixed this locally with the attached patch. Please let me know your thoughts. If you agree with this I will submit it.<div><div><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 4, 2016 at 12:19 PM Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">These tests appear to be broken on Windows, at least on my machine.<div><br></div><div><div>******************** TEST 'LLVM-Unit :: Support/SupportTests.exe/TargetParserTest.ARMparseCPUArch' FAILED ********************</div><div>Note: Google Test filter = TargetParserTest.ARMparseCPUArch</div><div>[==========] Running 1 test from 1 test case.</div><div>[----------] Global test environment set-up.</div><div>[----------] 1 test from TargetParserTest</div><div>[ RUN ] TargetParserTest.ARMparseCPUArch</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div><div>Expected: true</div><div>D:\src\llvm\unittests\Support\TargetParserTest.cpp(319): error: Value of: contains(CPU, ARMCPUName.Name) ? (ARM::AK_INVALID != ARM::parseCPUArch(ARMCPUName.Name)) : (ARM::AK_INVALID == ARM::parseCPUArch(ARMCPUName.Name))</div><div> Actual: false</div></div><div><br></div><div>Do you need additional info to help diagnose this? </div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 29, 2016 at 12:48 AM Jojo Ma via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi Daniel,<br>
<br>
Thank you very much! I didn't notice the problem.<br>
<br>
I have submit a fix: <a href="https://reviews.llvm.org/D22956" rel="noreferrer" target="_blank">https://reviews.llvm.org/D22956</a>, It would be appreciated if<br>
you could help me with your comments.<br>
<br>
On 28 July 2016 at 18:02, Daniel Jasper <<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>> wrote:<br>
> I removed two of the tests in r276969. They loop over the entire int range,<br>
> which doesn't seem reasonable. Feel free to revert that deletion and fix the<br>
> tests.<br>
><br>
> On Thu, Jul 28, 2016 at 8:11 AM, Zijiao Ma via llvm-commits<br>
> <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>> Author: zijiaoma<br>
>> Date: Thu Jul 28 01:11:18 2016<br>
>> New Revision: 276957<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=276957&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=276957&view=rev</a><br>
>> Log:<br>
>> Add unittests to {ARM | AArch64}TargetParser.<br>
>><br>
>> Add unittest to {ARM | AArch64}TargetParser,and by the way correct<br>
>> problems as below:<br>
>> 1.Correct a incorrect indexing problem in AArch64TargetParser. The<br>
>> architecture enumeration<br>
>> is shared across ARM and AArch64 in original implementation.But In the<br>
>> code,I just used the<br>
>> index which was offset by the ARM, and this would index into the array<br>
>> incorrectly. To make<br>
>> AArch64 has its own arch enum,or we will do a lot of slowly iterating.<br>
>> 2.Correct a spelling error. The parameter of<br>
>> llvm::AArch64::getArchExtName.<br>
>> 3.Correct a writing mistake, in llvm::ARM::parseArchISA.<br>
>><br>
>> Differential Revision: <a href="https://reviews.llvm.org/D21785" rel="noreferrer" target="_blank">https://reviews.llvm.org/D21785</a><br>
>><br>
>> Modified:<br>
>> llvm/trunk/include/llvm/Support/AArch64TargetParser.def<br>
>> llvm/trunk/include/llvm/Support/TargetParser.h<br>
>> llvm/trunk/lib/Support/TargetParser.cpp<br>
>> llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp<br>
>> llvm/trunk/unittests/Support/TargetParserTest.cpp<br>
>><br>
>> Modified: llvm/trunk/include/llvm/Support/AArch64TargetParser.def<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AArch64TargetParser.def?rev=276957&r1=276956&r2=276957&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/AArch64TargetParser.def?rev=276957&r1=276956&r2=276957&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/Support/AArch64TargetParser.def (original)<br>
>> +++ llvm/trunk/include/llvm/Support/AArch64TargetParser.def Thu Jul 28<br>
>> 01:11:18 2016<br>
>> @@ -16,6 +16,8 @@<br>
>> #ifndef AARCH64_ARCH<br>
>> #define AARCH64_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU,<br>
>> ARCH_BASE_EXT)<br>
>> #endif<br>
>> +AARCH64_ARCH("invalid", AK_INVALID, nullptr, nullptr,<br>
>> + ARMBuildAttrs::CPUArch::v8_A, FK_NONE, AArch64::AEK_NONE)<br>
>> AARCH64_ARCH("armv8-a", AK_ARMV8A, "8-A", "v8",<br>
>> ARMBuildAttrs::CPUArch::v8_A,<br>
>> FK_CRYPTO_NEON_FP_ARMV8,<br>
>> (AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |<br>
>><br>
>> Modified: llvm/trunk/include/llvm/Support/TargetParser.h<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetParser.h?rev=276957&r1=276956&r2=276957&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetParser.h?rev=276957&r1=276956&r2=276957&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/Support/TargetParser.h (original)<br>
>> +++ llvm/trunk/include/llvm/Support/TargetParser.h Thu Jul 28 01:11:18<br>
>> 2016<br>
>> @@ -145,6 +145,13 @@ unsigned parseArchVersion(StringRef Arch<br>
>> // FIXME:This should be made into class design,to avoid dupplication.<br>
>> namespace AArch64 {<br>
>><br>
>> +// Arch names.<br>
>> +enum class ArchKind {<br>
>> +#define AARCH64_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU,<br>
>> ARCH_BASE_EXT) ID,<br>
>> +#include "AArch64TargetParser.def"<br>
>> + AK_LAST<br>
>> +};<br>
>> +<br>
>> // Arch extension modifiers for CPUs.<br>
>> enum ArchExtKind : unsigned {<br>
>> AEK_INVALID = 0x0,<br>
>><br>
>> Modified: llvm/trunk/lib/Support/TargetParser.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetParser.cpp?rev=276957&r1=276956&r2=276957&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetParser.cpp?rev=276957&r1=276956&r2=276957&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Support/TargetParser.cpp (original)<br>
>> +++ llvm/trunk/lib/Support/TargetParser.cpp Thu Jul 28 01:11:18 2016<br>
>> @@ -52,7 +52,7 @@ static const struct {<br>
>> // of the triples and are not conforming with their official names.<br>
>> // Check to see if the expectation should be changed.<br>
>> // FIXME: TableGen this.<br>
>> -static const struct {<br>
>> +template <typename T> struct ArchNames {<br>
>> const char *NameCStr;<br>
>> size_t NameLength;<br>
>> const char *CPUAttrCStr;<br>
>> @@ -61,7 +61,7 @@ static const struct {<br>
>> size_t SubArchLength;<br>
>> unsigned DefaultFPU;<br>
>> unsigned ArchBaseExtensions;<br>
>> - ARM::ArchKind ID;<br>
>> + T ID;<br>
>> ARMBuildAttrs::CPUArch ArchAttr; // Arch ID in build attributes.<br>
>><br>
>> StringRef getName() const { return StringRef(NameCStr, NameLength); }<br>
>> @@ -71,18 +71,22 @@ static const struct {<br>
>><br>
>> // Sub-Arch name.<br>
>> StringRef getSubArch() const { return StringRef(SubArchCStr,<br>
>> SubArchLength); }<br>
>> -} ARCHNames[] = {<br>
>> +};<br>
>> +ArchNames<ARM::ArchKind> ARCHNames[] = {<br>
>> #define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU,<br>
>> ARCH_BASE_EXT) \<br>
>> {NAME, sizeof(NAME) - 1, CPU_ATTR, sizeof(CPU_ATTR) - 1, SUB_ARCH,<br>
>> \<br>
>> sizeof(SUB_ARCH) - 1, ARCH_FPU, ARCH_BASE_EXT, ID, ARCH_ATTR},<br>
>> #include "llvm/Support/ARMTargetParser.def"<br>
>> -},AArch64ARCHNames[] = {<br>
>> -#define AARCH64_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU,<br>
>> ARCH_BASE_EXT) \<br>
>> - {NAME, sizeof(NAME) - 1, CPU_ATTR, sizeof(CPU_ATTR) - 1, SUB_ARCH,<br>
>> \<br>
>> - sizeof(SUB_ARCH) - 1, ARCH_FPU, ARCH_BASE_EXT, ID, ARCH_ATTR},<br>
>> -#include "llvm/Support/AArch64TargetParser.def"<br>
>> };<br>
>><br>
>> +ArchNames<AArch64::ArchKind> AArch64ARCHNames[] = {<br>
>> + #define AARCH64_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU,<br>
>> ARCH_BASE_EXT) \<br>
>> + {NAME, sizeof(NAME) - 1, CPU_ATTR, sizeof(CPU_ATTR) - 1, SUB_ARCH,<br>
>> \<br>
>> + sizeof(SUB_ARCH) - 1, ARCH_FPU, ARCH_BASE_EXT, AArch64::ArchKind::ID,<br>
>> ARCH_ATTR},<br>
>> + #include "llvm/Support/AArch64TargetParser.def"<br>
>> + };<br>
>> +<br>
>> +<br>
>> // List of Arch Extension names.<br>
>> // FIXME: TableGen this.<br>
>> static const struct {<br>
>> @@ -122,24 +126,27 @@ static const struct {<br>
>> // When finding the Arch for a CPU, first-found prevails. Sort them<br>
>> accordingly.<br>
>> // When this becomes table-generated, we'd probably need two tables.<br>
>> // FIXME: TableGen this.<br>
>> -static const struct {<br>
>> +template <typename T> struct CpuNames {<br>
>> const char *NameCStr;<br>
>> size_t NameLength;<br>
>> - ARM::ArchKind ArchID;<br>
>> + T ArchID;<br>
>> bool Default; // is $Name the default CPU for $ArchID ?<br>
>> unsigned DefaultExtensions;<br>
>><br>
>> StringRef getName() const { return StringRef(NameCStr, NameLength); }<br>
>> -} CPUNames[] = {<br>
>> +};<br>
>> +CpuNames<ARM::ArchKind> CPUNames[] = {<br>
>> #define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \<br>
>> { NAME, sizeof(NAME) - 1, ID, IS_DEFAULT, DEFAULT_EXT },<br>
>> #include "llvm/Support/ARMTargetParser.def"<br>
>> -},AArch64CPUNames[] = {<br>
>> -#define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT)<br>
>> \<br>
>> - { NAME, sizeof(NAME) - 1, ID, IS_DEFAULT, DEFAULT_EXT },<br>
>> -#include "llvm/Support/AArch64TargetParser.def"<br>
>> };<br>
>><br>
>> +CpuNames<AArch64::ArchKind> AArch64CPUNames[] = {<br>
>> + #define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT)<br>
>> \<br>
>> + { NAME, sizeof(NAME) - 1, AArch64::ArchKind::ID, IS_DEFAULT,<br>
>> DEFAULT_EXT },<br>
>> + #include "llvm/Support/AArch64TargetParser.def"<br>
>> + };<br>
>> +<br>
>> } // namespace<br>
>><br>
>> // ======================================================= //<br>
>> @@ -416,7 +423,7 @@ unsigned llvm::AArch64::getDefaultExtens<br>
>><br>
>> return StringSwitch<unsigned>(CPU)<br>
>> #define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT)<br>
>> \<br>
>> - .Case(NAME, AArch64ARCHNames[ID].ArchBaseExtensions | DEFAULT_EXT)<br>
>> + .Case(NAME, DEFAULT_EXT)<br>
>> #include "llvm/Support/AArch64TargetParser.def"<br>
>> .Default(AArch64::AEK_INVALID);<br>
>> }<br>
>> @@ -452,48 +459,44 @@ bool llvm::AArch64::getFPUFeatures(unsig<br>
>><br>
>> bool llvm::AArch64::getArchFeatures(unsigned ArchKind,<br>
>> std::vector<const char *> &Features)<br>
>> {<br>
>> - if (ArchKind == ARM::AK_INVALID || ArchKind >= ARM::AK_LAST)<br>
>> - return false;<br>
>> -<br>
>> - if (ArchKind == ARM::AK_ARMV8_1A)<br>
>> + if (ArchKind == static_cast<unsigned>(AArch64::ArchKind::AK_ARMV8_1A))<br>
>> Features.push_back("+v8.1a");<br>
>> - if (ArchKind == ARM::AK_ARMV8_2A)<br>
>> + if (ArchKind == static_cast<unsigned>(AArch64::ArchKind::AK_ARMV8_2A))<br>
>> Features.push_back("+v8.2a");<br>
>><br>
>> - return true;<br>
>> + return ArchKind > static_cast<unsigned>(AArch64::ArchKind::AK_INVALID)<br>
>> &&<br>
>> + ArchKind < static_cast<unsigned>(AArch64::ArchKind::AK_LAST);<br>
>> }<br>
>><br>
>> StringRef llvm::AArch64::getArchName(unsigned ArchKind) {<br>
>> - for (const auto &AI : AArch64ARCHNames)<br>
>> - if (<a href="http://AI.ID" rel="noreferrer" target="_blank">AI.ID</a> == ArchKind)<br>
>> - return AI.getName();<br>
>> - return StringRef();<br>
>> + if (ArchKind >= static_cast<unsigned>(AArch64::ArchKind::AK_LAST))<br>
>> + return StringRef();<br>
>> + return AArch64ARCHNames[ArchKind].getName();<br>
>> }<br>
>><br>
>> StringRef llvm::AArch64::getCPUAttr(unsigned ArchKind) {<br>
>> - for (const auto &AI : AArch64ARCHNames)<br>
>> - if (<a href="http://AI.ID" rel="noreferrer" target="_blank">AI.ID</a> == ArchKind)<br>
>> - return AI.getCPUAttr();<br>
>> - return StringRef();<br>
>> + if (ArchKind == static_cast<unsigned>(AArch64::ArchKind::AK_INVALID) ||<br>
>> + ArchKind >= static_cast<unsigned>(AArch64::ArchKind::AK_LAST))<br>
>> + return StringRef();<br>
>> + return AArch64ARCHNames[ArchKind].getCPUAttr();<br>
>> }<br>
>><br>
>> StringRef llvm::AArch64::getSubArch(unsigned ArchKind) {<br>
>> - for (const auto &AI : AArch64ARCHNames)<br>
>> - if (<a href="http://AI.ID" rel="noreferrer" target="_blank">AI.ID</a> == ArchKind)<br>
>> - return AI.getSubArch();<br>
>> - return StringRef();<br>
>> + if (ArchKind == static_cast<unsigned>(AArch64::ArchKind::AK_INVALID) ||<br>
>> + ArchKind >= static_cast<unsigned>(AArch64::ArchKind::AK_LAST))<br>
>> + return StringRef();<br>
>> + return AArch64ARCHNames[ArchKind].getSubArch();<br>
>> }<br>
>><br>
>> unsigned llvm::AArch64::getArchAttr(unsigned ArchKind) {<br>
>> - for (const auto &AI : AArch64ARCHNames)<br>
>> - if (<a href="http://AI.ID" rel="noreferrer" target="_blank">AI.ID</a> == ArchKind)<br>
>> - return AI.ArchAttr;<br>
>> - return ARMBuildAttrs::CPUArch::v8_A;<br>
>> + if (ArchKind >= static_cast<unsigned>(AArch64::ArchKind::AK_LAST))<br>
>> + return ARMBuildAttrs::CPUArch::v8_A;<br>
>> + return AArch64ARCHNames[ArchKind].ArchAttr;<br>
>> }<br>
>><br>
>> -StringRef llvm::AArch64::getArchExtName(unsigned AArchExtKind) {<br>
>> +StringRef llvm::AArch64::getArchExtName(unsigned ArchExtKind) {<br>
>> for (const auto &AE : AArch64ARCHExtNames)<br>
>> - if (AArchExtKind == <a href="http://AE.ID" rel="noreferrer" target="_blank">AE.ID</a>)<br>
>> + if (ArchExtKind == <a href="http://AE.ID" rel="noreferrer" target="_blank">AE.ID</a>)<br>
>> return AE.getName();<br>
>> return StringRef();<br>
>> }<br>
>> @@ -515,12 +518,12 @@ const char *llvm::AArch64::getArchExtFea<br>
>><br>
>> StringRef llvm::AArch64::getDefaultCPU(StringRef Arch) {<br>
>> unsigned AK = parseArch(Arch);<br>
>> - if (AK == ARM::AK_INVALID)<br>
>> + if (AK == static_cast<unsigned>(AArch64::ArchKind::AK_INVALID))<br>
>> return StringRef();<br>
>><br>
>> // Look for multiple AKs to find the default for pair AK+Name.<br>
>> for (const auto &CPU : AArch64CPUNames)<br>
>> - if (CPU.ArchID == AK && CPU.Default)<br>
>> + if (static_cast<unsigned>(CPU.ArchID) == AK && CPU.Default)<br>
>> return CPU.getName();<br>
>><br>
>> // If we can't find a default then target the architecture instead<br>
>> @@ -685,7 +688,7 @@ unsigned llvm::ARM::parseArchISA(StringR<br>
>> .StartsWith("arm64", ARM::IK_AARCH64)<br>
>> .StartsWith("thumb", ARM::IK_THUMB)<br>
>> .StartsWith("arm", ARM::IK_ARM)<br>
>> - .Default(ARM::EK_INVALID);<br>
>> + .Default(ARM::IK_INVALID);<br>
>> }<br>
>><br>
>> // Little/Big endian<br>
>> @@ -784,14 +787,14 @@ unsigned llvm::AArch64::parseFPU(StringR<br>
>> unsigned llvm::AArch64::parseArch(StringRef Arch) {<br>
>> Arch = getCanonicalArchName(Arch);<br>
>> if (checkArchVersion(Arch) < 8)<br>
>> - return ARM::AK_INVALID;<br>
>> + return static_cast<unsigned>(AArch64::ArchKind::AK_INVALID);<br>
>><br>
>> StringRef Syn = getArchSynonym(Arch);<br>
>> for (const auto A : AArch64ARCHNames) {<br>
>> if (A.getName().endswith(Syn))<br>
>> - return <a href="http://A.ID" rel="noreferrer" target="_blank">A.ID</a>;<br>
>> + return static_cast<unsigned>(<a href="http://A.ID" rel="noreferrer" target="_blank">A.ID</a>);<br>
>> }<br>
>> - return ARM::AK_INVALID;<br>
>> + return static_cast<unsigned>(AArch64::ArchKind::AK_INVALID);<br>
>> }<br>
>><br>
>> unsigned llvm::AArch64::parseArchExt(StringRef ArchExt) {<br>
>> @@ -805,9 +808,9 @@ unsigned llvm::AArch64::parseArchExt(Str<br>
>> unsigned llvm::AArch64::parseCPUArch(StringRef CPU) {<br>
>> for (const auto C : AArch64CPUNames) {<br>
>> if (CPU == C.getName())<br>
>> - return C.ArchID;<br>
>> + return static_cast<unsigned>(C.ArchID);<br>
>> }<br>
>> - return ARM::AK_INVALID;<br>
>> + return static_cast<unsigned>(AArch64::ArchKind::AK_INVALID);<br>
>> }<br>
>><br>
>> // ARM, Thumb, AArch64<br>
>><br>
>> Modified: llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp?rev=276957&r1=276956&r2=276957&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp?rev=276957&r1=276956&r2=276957&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp<br>
>> (original)<br>
>> +++ llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp Thu Jul<br>
>> 28 01:11:18 2016<br>
>> @@ -4212,7 +4212,7 @@ bool AArch64AsmParser::parseDirectiveArc<br>
>> getParser().parseStringToEndOfStatement().trim().split('+');<br>
>><br>
>> unsigned ID = AArch64::parseArch(Arch);<br>
>> - if (ID == ARM::AK_INVALID) {<br>
>> + if (ID == static_cast<unsigned>(AArch64::ArchKind::AK_INVALID)) {<br>
>> Error(ArchLoc, "unknown arch name");<br>
>> return false;<br>
>> }<br>
>><br>
>> Modified: llvm/trunk/unittests/Support/TargetParserTest.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TargetParserTest.cpp?rev=276957&r1=276956&r2=276957&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TargetParserTest.cpp?rev=276957&r1=276956&r2=276957&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/unittests/Support/TargetParserTest.cpp (original)<br>
>> +++ llvm/trunk/unittests/Support/TargetParserTest.cpp Thu Jul 28 01:11:18<br>
>> 2016<br>
>> @@ -7,19 +7,85 @@<br>
>> //<br>
>><br>
>> //===----------------------------------------------------------------------===//<br>
>><br>
>> -#include "gtest/gtest.h"<br>
>> +#include "llvm/ADT/STLExtras.h"<br>
>> +#include "llvm/Support/ARMBuildAttributes.h"<br>
>> #include "llvm/Support/TargetParser.h"<br>
>> +#include "gtest/gtest.h"<br>
>> +#include <string><br>
>><br>
>> using namespace llvm;<br>
>><br>
>> namespace {<br>
>> -static const unsigned kAArch64ArchKinds[] = {<br>
>> +static const unsigned kHWDivKinds[] = {<br>
>> +#define ARM_HW_DIV_NAME(NAME, ID) ID,<br>
>> +#include "llvm/Support/ARMTargetParser.def"<br>
>> +#undef ARM_HW_DIV_NAME<br>
>> +};<br>
>> +<br>
>> +static const unsigned kARMArchExtKinds[] = {<br>
>> +#define ARM_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) ID,<br>
>> +#include "llvm/Support/ARMTargetParser.def"<br>
>> +#undef ARM_ARCH_EXT_NAME<br>
>> +};<br>
>> +<br>
>> +static const unsigned kAArch64ArchExtKinds[] = {<br>
>> +#define AARCH64_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) ID,<br>
>> +#include "llvm/Support/AArch64TargetParser.def"<br>
>> +#undef AARCH64_ARCH_EXT_NAME<br>
>> +};<br>
>> +<br>
>> +template <typename T> struct ArchNames {<br>
>> + const char *Name;<br>
>> + unsigned DefaultFPU;<br>
>> + unsigned ArchBaseExtensions;<br>
>> + T ID;<br>
>> + ARMBuildAttrs::CPUArch ArchAttr;<br>
>> +};<br>
>> +ArchNames<AArch64::ArchKind> kAArch64ARCHNames[] = {<br>
>> #define AARCH64_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU,<br>
>> \<br>
>> ARCH_BASE_EXT)<br>
>> \<br>
>> - llvm::ARM::ID,<br>
>> + {NAME, ARM::ARCH_FPU, ARCH_BASE_EXT, AArch64::ArchKind::ID, ARCH_ATTR},<br>
>> #include "llvm/Support/AArch64TargetParser.def"<br>
>> #undef AARCH64_ARCH<br>
>> };<br>
>> +ArchNames<ARM::ArchKind> kARMARCHNames[] = {<br>
>> +#define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU,<br>
>> \<br>
>> + ARCH_BASE_EXT)<br>
>> \<br>
>> + {NAME, ARM::ARCH_FPU, ARCH_BASE_EXT, ARM::ID, ARCH_ATTR},<br>
>> +#include "llvm/Support/ARMTargetParser.def"<br>
>> +#undef ARM_ARCH<br>
>> +};<br>
>> +<br>
>> +template <typename T> struct CpuNames {<br>
>> + const char *Name;<br>
>> + T ID;<br>
>> + unsigned DefaultFPU;<br>
>> + unsigned DefaultExt;<br>
>> +};<br>
>> +CpuNames<AArch64::ArchKind> kAArch64CPUNames[] = {<br>
>> +#define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT)<br>
>> \<br>
>> + {NAME, AArch64::ArchKind::ID, ARM::DEFAULT_FPU, DEFAULT_EXT},<br>
>> +#include "llvm/Support/AArch64TargetParser.def"<br>
>> +#undef AARCH64_CPU_NAME<br>
>> +};<br>
>> +CpuNames<ARM::ArchKind> kARMCPUNames[] = {<br>
>> +#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT)<br>
>> \<br>
>> + {NAME, ARM::ID, ARM::DEFAULT_FPU, DEFAULT_EXT},<br>
>> +#include "llvm/Support/ARMTargetParser.def"<br>
>> +#undef ARM_CPU_NAME<br>
>> +};<br>
>> +<br>
>> +const char *ARMArch[] = {<br>
>> + "armv2", "armv2a", "armv3", "armv3m", "armv4",<br>
>> + "armv4t", "armv5", "armv5t", "armv5e", "armv5te",<br>
>> + "armv5tej", "armv6", "armv6j", "armv6k", "armv6hl",<br>
>> + "armv6t2", "armv6kz", "armv6z", "armv6zk", "armv6-m",<br>
>> + "armv6m", "armv6sm", "armv6s-m", "armv7-a", "armv7",<br>
>> + "armv7a", "armv7hl", "armv7l", "armv7-r", "armv7r",<br>
>> + "armv7-m", "armv7m", "armv7k", "armv7s",<br>
>> "armv7e-m",<br>
>> + "armv7em", "armv8-a", "armv8", "armv8a",<br>
>> "armv8.1-a",<br>
>> + "armv8.1a", "armv8.2-a", "armv8.2a", "armv8-m.base",<br>
>> "armv8m.base",<br>
>> + "armv8-m.main", "armv8m.main", "iwmmxt", "iwmmxt2", "xscale"};<br>
>><br>
>> template <typename T, size_t N><br>
>> bool contains(const T (&array)[N], const T element) {<br>
>> @@ -62,31 +128,450 @@ TEST(TargetParserTest, ARMFPUName) {<br>
>> : !ARM::getFPUName(FK).empty());<br>
>> }<br>
>><br>
>> -TEST(TargetParserTest, AArch64ArchName) {<br>
>> +TEST(TargetParserTest, ARMFPUVersion) {<br>
>> + for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);<br>
>> + FK <= ARM::FPUKind::FK_LAST;<br>
>> + FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1))<br>
>> + if (FK == ARM::FK_LAST)<br>
>> + EXPECT_EQ(0, ARM::getFPUVersion(FK));<br>
>> + else<br>
>> + EXPECT_LE(0, ARM::getFPUVersion(FK));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMFPUNeonSupportLevel) {<br>
>> + for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);<br>
>> + FK <= ARM::FPUKind::FK_LAST;<br>
>> + FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1))<br>
>> + if (FK == ARM::FK_LAST)<br>
>> + EXPECT_EQ(0, ARM::getFPUNeonSupportLevel(FK));<br>
>> + else<br>
>> + EXPECT_LE(0, ARM::getFPUNeonSupportLevel(FK));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMFPURestriction) {<br>
>> + for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);<br>
>> + FK <= ARM::FPUKind::FK_LAST;<br>
>> + FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1))<br>
>> + if (FK == ARM::FK_LAST)<br>
>> + EXPECT_EQ(0, ARM::getFPURestriction(FK));<br>
>> + else<br>
>> + EXPECT_LE(0, ARM::getFPURestriction(FK));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMDefaultFPU) {<br>
>> for (ARM::ArchKind AK = static_cast<ARM::ArchKind>(0);<br>
>> - AK <= ARM::ArchKind::AK_LAST;<br>
>> + AK < ARM::ArchKind::AK_LAST;<br>
>> AK = static_cast<ARM::ArchKind>(static_cast<unsigned>(AK) + 1))<br>
>> - EXPECT_TRUE(contains(kAArch64ArchKinds, static_cast<unsigned>(AK))<br>
>> - ? !AArch64::getArchName(AK).empty()<br>
>> - : AArch64::getArchName(AK).empty());<br>
>> + EXPECT_EQ(kARMARCHNames[AK].DefaultFPU,<br>
>> + ARM::getDefaultFPU(StringRef("generic"), AK));<br>
>> +<br>
>> + for (const auto &ARMCPUName : kARMCPUNames)<br>
>> + EXPECT_EQ(ARMCPUName.DefaultFPU, ARM::getDefaultFPU(ARMCPUName.Name,<br>
>> 0));<br>
>> }<br>
>><br>
>> -TEST(TargetParserTest, AArch64CPUAttr) {<br>
>> +TEST(TargetParserTest, ARMDefaultExtensions) {<br>
>> for (ARM::ArchKind AK = static_cast<ARM::ArchKind>(0);<br>
>> - AK <= ARM::ArchKind::AK_LAST;<br>
>> + AK < ARM::ArchKind::AK_LAST;<br>
>> AK = static_cast<ARM::ArchKind>(static_cast<unsigned>(AK) + 1))<br>
>> - EXPECT_TRUE(contains(kAArch64ArchKinds, static_cast<unsigned>(AK))<br>
>> - ? !AArch64::getCPUAttr(AK).empty()<br>
>> - : AArch64::getCPUAttr(AK).empty());<br>
>> + EXPECT_EQ(kARMARCHNames[AK].ArchBaseExtensions,<br>
>> + ARM::getDefaultExtensions(StringRef("generic"), AK));<br>
>> +<br>
>> + for (const auto &ARMCPUName : kARMCPUNames) {<br>
>> + unsigned DefaultExt =<br>
>> + kARMARCHNames[ARMCPUName.ID].ArchBaseExtensions |<br>
>> ARMCPUName.DefaultExt;<br>
>> + EXPECT_EQ(DefaultExt, ARM::getDefaultExtensions(ARMCPUName.Name, 0));<br>
>> + }<br>
>> }<br>
>><br>
>> -TEST(TargetParserTest, AArch64SubArch) {<br>
>> +TEST(TargetParserTest, ARMExtensionFeatures) {<br>
>> + std::vector<const char *> Features;<br>
>> + unsigned Extensions = ARM::AEK_CRC | ARM::AEK_CRYPTO | ARM::AEK_DSP |<br>
>> + ARM::AEK_HWDIVARM | ARM::AEK_HWDIV | ARM::AEK_MP<br>
>> |<br>
>> + ARM::AEK_SEC | ARM::AEK_VIRT | ARM::AEK_RAS;<br>
>> +<br>
>> + for (unsigned i = 0; i <= Extensions; i++)<br>
>> + EXPECT_TRUE(i == 0 ? !ARM::getExtensionFeatures(i, Features)<br>
>> + : ARM::getExtensionFeatures(i, Features));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMFPUFeatures) {<br>
>> + std::vector<const char *> Features;<br>
>> + for (ARM::FPUKind FK = static_cast<ARM::FPUKind>(0);<br>
>> + FK <= ARM::FPUKind::FK_LAST;<br>
>> + FK = static_cast<ARM::FPUKind>(static_cast<unsigned>(FK) + 1))<br>
>> + EXPECT_TRUE((FK == ARM::FK_INVALID || FK >= ARM::FK_LAST)<br>
>> + ? !ARM::getFPUFeatures(FK, Features)<br>
>> + : ARM::getFPUFeatures(FK, Features));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMArchAttr) {<br>
>> for (ARM::ArchKind AK = static_cast<ARM::ArchKind>(0);<br>
>> AK <= ARM::ArchKind::AK_LAST;<br>
>> AK = static_cast<ARM::ArchKind>(static_cast<unsigned>(AK) + 1))<br>
>> - EXPECT_TRUE(contains(kAArch64ArchKinds, static_cast<unsigned>(AK))<br>
>> - ? !AArch64::getSubArch(AK).empty()<br>
>> - : AArch64::getSubArch(AK).empty());<br>
>> + EXPECT_TRUE(AK == ARM::AK_LAST<br>
>> + ? (ARMBuildAttrs::CPUArch::Pre_v4 ==<br>
>> ARM::getArchAttr(AK))<br>
>> + : (kARMARCHNames[AK].ArchAttr ==<br>
>> ARM::getArchAttr(AK)));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMArchExtName) {<br>
>> + for (ARM::ArchExtKind AEK = static_cast<ARM::ArchExtKind>(0);<br>
>> + AEK <= ARM::ArchExtKind::AEK_XSCALE;<br>
>> + AEK = static_cast<ARM::ArchExtKind>(static_cast<unsigned>(AEK) +<br>
>> 1))<br>
>> + EXPECT_TRUE(contains(kARMArchExtKinds, static_cast<unsigned>(AEK))<br>
>> + ? !ARM::getArchExtName(AEK).empty()<br>
>> + : ARM::getArchExtName(AEK).empty());<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMArchExtFeature) {<br>
>> + const char *ArchExt[][4] = {{"crc", "nocrc", "+crc", "-crc"},<br>
>> + {"crypto", "nocrypto", "+crypto",<br>
>> "-crypto"},<br>
>> + {"dsp", "nodsp", "+dsp", "-dsp"},<br>
>> + {"fp", "nofp", nullptr, nullptr},<br>
>> + {"idiv", "noidiv", nullptr, nullptr},<br>
>> + {"mp", "nomp", nullptr, nullptr},<br>
>> + {"simd", "nosimd", nullptr, nullptr},<br>
>> + {"sec", "nosec", nullptr, nullptr},<br>
>> + {"virt", "novirt", nullptr, nullptr},<br>
>> + {"fp16", "nofp16", "+fullfp16",<br>
>> "-fullfp16"},<br>
>> + {"ras", "noras", "+ras", "-ras"},<br>
>> + {"os", "noos", nullptr, nullptr},<br>
>> + {"iwmmxt", "noiwmmxt", nullptr, nullptr},<br>
>> + {"iwmmxt2", "noiwmmxt2", nullptr, nullptr},<br>
>> + {"maverick", "maverick", nullptr, nullptr},<br>
>> + {"xscale", "noxscale", nullptr, nullptr}};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {<br>
>> + EXPECT_EQ(ArchExt[i][2], ARM::getArchExtFeature(ArchExt[i][0]));<br>
>> + EXPECT_EQ(ArchExt[i][3], ARM::getArchExtFeature(ArchExt[i][1]));<br>
>> + }<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMHWDivName) {<br>
>> + for (ARM::ArchExtKind AEK = static_cast<ARM::ArchExtKind>(0);<br>
>> + AEK <= ARM::ArchExtKind::AEK_XSCALE;<br>
>> + AEK = static_cast<ARM::ArchExtKind>(static_cast<unsigned>(AEK) +<br>
>> 1))<br>
>> + EXPECT_TRUE(contains(kHWDivKinds, static_cast<unsigned>(AEK))<br>
>> + ? !ARM::getHWDivName(AEK).empty()<br>
>> + : ARM::getHWDivName(AEK).empty());<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMDefaultCPU) {<br>
>> + for (unsigned i = 0; i < array_lengthof(ARMArch); i++)<br>
>> + EXPECT_FALSE(ARM::getDefaultCPU(ARMArch[i]).empty());<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMparseHWDiv) {<br>
>> + const char *hwdiv[] = {"thumb", "arm", "arm,thumb", "thumb,arm"};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(hwdiv); i++)<br>
>> + EXPECT_NE(ARM::AEK_INVALID, ARM::parseHWDiv((StringRef)hwdiv[i]));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMparseFPU) {<br>
>> + const char *FPU[] = {"vfp",<br>
>> + "vfpv2",<br>
>> + "vfp2",<br>
>> + "vfpv3",<br>
>> + "vfp3",<br>
>> + "vfpv3-fp16",<br>
>> + "vfpv3-d16",<br>
>> + "vfp3-d16",<br>
>> + "vfpv3-d16-fp16",<br>
>> + "vfpv3xd",<br>
>> + "vfpv3xd-fp16",<br>
>> + "vfpv4",<br>
>> + "vfp4",<br>
>> + "vfpv4-d16",<br>
>> + "vfp4-d16",<br>
>> + "fp4-dp-d16",<br>
>> + "fpv4-dp-d16",<br>
>> + "fpv4-sp-d16",<br>
>> + "fp4-sp-d16",<br>
>> + "vfpv4-sp-d16",<br>
>> + "fpv5-d16",<br>
>> + "fp5-dp-d16",<br>
>> + "fpv5-dp-d16",<br>
>> + "fpv5-sp-d16",<br>
>> + "fp5-sp-d16",<br>
>> + "fp-armv8",<br>
>> + "neon",<br>
>> + "neon-vfpv3",<br>
>> + "neon-fp16",<br>
>> + "neon-vfpv4",<br>
>> + "neon-fp-armv8",<br>
>> + "crypto-neon-fp-armv8",<br>
>> + "softvfp"};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(FPU); i++)<br>
>> + EXPECT_NE(ARM::FK_INVALID, ARM::parseFPU((StringRef)FPU[i]));<br>
>> }<br>
>> +<br>
>> +TEST(TargetParserTest, ARMparseArch) {<br>
>> + for (unsigned i = 0; i < array_lengthof(ARMArch); i++)<br>
>> + EXPECT_NE(ARM::AEK_INVALID, ARM::parseArch(ARMArch[i]));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMparseArchExt) {<br>
>> + const char *ArchExt[] = {"none", "crc", "crypto", "dsp", "fp",<br>
>> + "idiv", "mp", "simd", "sec",<br>
>> "virt",<br>
>> + "fp16", "ras", "os", "iwmmxt",<br>
>> "iwmmxt2",<br>
>> + "maverick", "xscale"};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(ArchExt); i++)<br>
>> + EXPECT_NE(ARM::AEK_INVALID, ARM::parseArchExt(ArchExt[i]));<br>
>> }<br>
>><br>
>> +TEST(TargetParserTest, ARMparseCPUArch) {<br>
>> + const char *CPU[] = {<br>
>> + "arm2", "arm3", "arm6", "arm7m",<br>
>> + "arm8", "arm810", "strongarm", "strongarm110",<br>
>> + "strongarm1100", "strongarm1110", "arm7tdmi", "arm7tdmi-s",<br>
>> + "arm710t", "arm720t", "arm9", "arm9tdmi",<br>
>> + "arm920", "arm920t", "arm922t", "arm9312",<br>
>> + "arm940t", "ep9312", "arm10tdmi", "arm1020t",<br>
>> + "arm9e", "arm946e-s", "arm966e-s", "arm968e-s",<br>
>> + "arm10e", "arm1020e", "arm1022e", "arm926ej-s",<br>
>> + "arm1136j-s", "arm1136jf-s", "arm1136jz-s", "arm1176j-s",<br>
>> + "arm1176jz-s", "mpcore", "mpcorenovfp", "arm1176jzf-s",<br>
>> + "arm1156t2-s", "arm1156t2f-s", "cortex-m0", "cortex-m0plus",<br>
>> + "cortex-m1", "sc000", "cortex-a5", "cortex-a7",<br>
>> + "cortex-a8", "cortex-a9", "cortex-a12", "cortex-a15",<br>
>> + "cortex-a17", "krait", "cortex-r4", "cortex-r4f",<br>
>> + "cortex-r5", "cortex-r7", "cortex-r8", "sc300",<br>
>> + "cortex-m3", "cortex-m4", "cortex-m7", "cortex-a32",<br>
>> + "cortex-a35", "cortex-a53", "cortex-a57", "cortex-a72",<br>
>> + "cortex-a73", "cyclone", "exynos-m1", "iwmmxt",<br>
>> + "xscale", "swift"};<br>
>> +<br>
>> + for (const auto &ARMCPUName : kARMCPUNames)<br>
>> + EXPECT_TRUE(contains(CPU, ARMCPUName.Name)<br>
>> + ? (ARM::AK_INVALID !=<br>
>> ARM::parseCPUArch(ARMCPUName.Name))<br>
>> + : (ARM::AK_INVALID ==<br>
>> ARM::parseCPUArch(ARMCPUName.Name)));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMparseArchEndianAndISA) {<br>
>> + const char *Arch[] = {<br>
>> + "v2", "v2a", "v3", "v3m", "v4", "v4t", "v5", "v5t",<br>
>> + "v5e", "v5te", "v5tej", "v6", "v6j", "v6k", "v6hl",<br>
>> "v6t2",<br>
>> + "v6kz", "v6z", "v6zk", "v6-m", "v6m", "v6sm", "v6s-m",<br>
>> "v7-a",<br>
>> + "v7", "v7a", "v7hl", "v7l", "v7-r", "v7r", "v7-m", "v7m",<br>
>> + "v7k", "v7s", "v7e-m", "v7em", "v8-a", "v8", "v8a",<br>
>> "v8.1-a",<br>
>> + "v8.1a", "v8.2-a", "v8.2a"};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(Arch); i++) {<br>
>> + std::string arm_1 = "armeb" + (std::string)(Arch[i]);<br>
>> + std::string arm_2 = "arm" + (std::string)(Arch[i]) + "eb";<br>
>> + std::string arm_3 = "arm" + (std::string)(Arch[i]);<br>
>> + std::string thumb_1 = "thumbeb" + (std::string)(Arch[i]);<br>
>> + std::string thumb_2 = "thumb" + (std::string)(Arch[i]) + "eb";<br>
>> + std::string thumb_3 = "thumb" + (std::string)(Arch[i]);<br>
>> +<br>
>> + EXPECT_EQ(ARM::EK_BIG, ARM::parseArchEndian(arm_1));<br>
>> + EXPECT_EQ(ARM::EK_BIG, ARM::parseArchEndian(arm_2));<br>
>> + EXPECT_EQ(ARM::EK_LITTLE, ARM::parseArchEndian(arm_3));<br>
>> +<br>
>> + EXPECT_EQ(ARM::IK_ARM, ARM::parseArchISA(arm_1));<br>
>> + EXPECT_EQ(ARM::IK_ARM, ARM::parseArchISA(arm_2));<br>
>> + EXPECT_EQ(ARM::IK_ARM, ARM::parseArchISA(arm_3));<br>
>> + if (i >= 4) {<br>
>> + EXPECT_EQ(ARM::EK_BIG, ARM::parseArchEndian(thumb_1));<br>
>> + EXPECT_EQ(ARM::EK_BIG, ARM::parseArchEndian(thumb_2));<br>
>> + EXPECT_EQ(ARM::EK_LITTLE, ARM::parseArchEndian(thumb_3));<br>
>> +<br>
>> + EXPECT_EQ(ARM::IK_THUMB, ARM::parseArchISA(thumb_1));<br>
>> + EXPECT_EQ(ARM::IK_THUMB, ARM::parseArchISA(thumb_2));<br>
>> + EXPECT_EQ(ARM::IK_THUMB, ARM::parseArchISA(thumb_3));<br>
>> + }<br>
>> + }<br>
>> +<br>
>> + EXPECT_EQ(ARM::EK_LITTLE, ARM::parseArchEndian("aarch64"));<br>
>> + EXPECT_EQ(ARM::EK_BIG, ARM::parseArchEndian("aarch64_be"));<br>
>> +<br>
>> + EXPECT_EQ(ARM::IK_AARCH64, ARM::parseArchISA("aarch64"));<br>
>> + EXPECT_EQ(ARM::IK_AARCH64, ARM::parseArchISA("aarch64_be"));<br>
>> + EXPECT_EQ(ARM::IK_AARCH64, ARM::parseArchISA("arm64"));<br>
>> + EXPECT_EQ(ARM::IK_AARCH64, ARM::parseArchISA("arm64_be"));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMparseArchProfile) {<br>
>> + for (unsigned i = 0; i < array_lengthof(ARMArch); i++) {<br>
>> + switch (ARM::parseArch(ARMArch[i])) {<br>
>> + case ARM::AK_ARMV6M:<br>
>> + case ARM::AK_ARMV7M:<br>
>> + case ARM::AK_ARMV7EM:<br>
>> + case ARM::AK_ARMV8MMainline:<br>
>> + case ARM::AK_ARMV8MBaseline:<br>
>> + EXPECT_EQ(ARM::PK_M, ARM::parseArchProfile(ARMArch[i]));<br>
>> + continue;<br>
>> + case ARM::AK_ARMV7R:<br>
>> + EXPECT_EQ(ARM::PK_R, ARM::parseArchProfile(ARMArch[i]));<br>
>> + continue;<br>
>> + case ARM::AK_ARMV7A:<br>
>> + case ARM::AK_ARMV7K:<br>
>> + case ARM::AK_ARMV8A:<br>
>> + case ARM::AK_ARMV8_1A:<br>
>> + case ARM::AK_ARMV8_2A:<br>
>> + EXPECT_EQ(ARM::PK_A, ARM::parseArchProfile(ARMArch[i]));<br>
>> + continue;<br>
>> + }<br>
>> + EXPECT_EQ(ARM::PK_INVALID, ARM::parseArchProfile(ARMArch[i]));<br>
>> + }<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, ARMparseArchVersion) {<br>
>> + for (unsigned i = 0; i < array_lengthof(ARMArch); i++)<br>
>> + if (((std::string)ARMArch[i]).substr(0, 4) == "armv")<br>
>> + EXPECT_EQ((ARMArch[i][4] - 48), ARM::parseArchVersion(ARMArch[i]));<br>
>> + else<br>
>> + EXPECT_EQ(5, ARM::parseArchVersion(ARMArch[i]));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64DefaultFPU) {<br>
>> + for (unsigned AK = 0; AK <<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_LAST);<br>
>> + AK++)<br>
>> + EXPECT_EQ(kAArch64ARCHNames[AK].DefaultFPU,<br>
>> + AArch64::getDefaultFPU(StringRef("generic"), AK));<br>
>> +<br>
>> + for (const auto &AArch64CPUName : kAArch64CPUNames)<br>
>> + EXPECT_EQ(AArch64CPUName.DefaultFPU,<br>
>> + AArch64::getDefaultFPU(AArch64CPUName.Name,<br>
>> +<br>
>> static_cast<unsigned>(AArch64CPUName.ID)));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64DefaultExt) {<br>
>> + for (unsigned AK = 0; AK <<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_LAST);<br>
>> + AK++)<br>
>> + EXPECT_EQ(kAArch64ARCHNames[AK].ArchBaseExtensions,<br>
>> + AArch64::getDefaultExtensions(StringRef("generic"), AK));<br>
>> +<br>
>> + for (const auto &AArch64CPUName : kAArch64CPUNames)<br>
>> + EXPECT_EQ(<br>
>> + AArch64CPUName.DefaultExt,<br>
>> + AArch64::getDefaultExtensions(<br>
>> + AArch64CPUName.Name,<br>
>> static_cast<unsigned>(AArch64CPUName.ID)));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64ExtensionFeatures) {<br>
>> + std::vector<const char *> Features;<br>
>> + unsigned Extensions = AArch64::AEK_CRC | AArch64::AEK_CRYPTO |<br>
>> + AArch64::AEK_FP | AArch64::AEK_SIMD |<br>
>> + AArch64::AEK_FP16 | AArch64::AEK_PROFILE |<br>
>> + AArch64::AEK_RAS;<br>
>> +<br>
>> + for (unsigned i = 0; i <= Extensions; i++)<br>
>> + EXPECT_TRUE(i == 0 ? !AArch64::getExtensionFeatures(i, Features)<br>
>> + : AArch64::getExtensionFeatures(i, Features));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64ArchFeatures) {<br>
>> + std::vector<const char *> Features;<br>
>> +<br>
>> + for (unsigned AK = 0; AK <<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_LAST);<br>
>> + AK++)<br>
>> + EXPECT_TRUE((AK ==<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_INVALID) ||<br>
>> + AK == static_cast<unsigned>(AArch64::ArchKind::AK_LAST))<br>
>> + ? !AArch64::getArchFeatures(AK, Features)<br>
>> + : AArch64::getArchFeatures(AK, Features));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64ArchName) {<br>
>> + for (unsigned AK = 0; AK <<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_LAST);<br>
>> + AK++)<br>
>> + EXPECT_TRUE(AK == static_cast<unsigned>(AArch64::ArchKind::AK_LAST)<br>
>> + ? AArch64::getArchName(AK).empty()<br>
>> + : !AArch64::getArchName(AK).empty());<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64CPUAttr) {<br>
>> + for (unsigned AK = 0; AK <<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_LAST);<br>
>> + AK++)<br>
>> + EXPECT_TRUE((AK ==<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_INVALID) ||<br>
>> + AK == static_cast<unsigned>(AArch64::ArchKind::AK_LAST))<br>
>> + ? AArch64::getCPUAttr(AK).empty()<br>
>> + : !AArch64::getCPUAttr(AK).empty());<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64SubArch) {<br>
>> + for (unsigned AK = 0; AK <<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_LAST);<br>
>> + AK++)<br>
>> + EXPECT_TRUE((AK ==<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_INVALID) ||<br>
>> + AK == static_cast<unsigned>(AArch64::ArchKind::AK_LAST))<br>
>> + ? AArch64::getSubArch(AK).empty()<br>
>> + : !AArch64::getSubArch(AK).empty());<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64ArchAttr) {<br>
>> + for (unsigned AK = 0; AK <<br>
>> static_cast<unsigned>(AArch64::ArchKind::AK_LAST);<br>
>> + AK++)<br>
>> + EXPECT_TRUE(<br>
>> + AK == static_cast<unsigned>(AArch64::ArchKind::AK_LAST)<br>
>> + ? (ARMBuildAttrs::CPUArch::v8_A == AArch64::getArchAttr(AK))<br>
>> + : (kAArch64ARCHNames[AK].ArchAttr ==<br>
>> AArch64::getArchAttr(AK)));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64ArchExtName) {<br>
>> + for (AArch64::ArchExtKind AEK = static_cast<AArch64::ArchExtKind>(0);<br>
>> + AEK <= AArch64::ArchExtKind::AEK_RAS;<br>
>> + AEK = static_cast<AArch64::ArchExtKind>(static_cast<unsigned>(AEK)<br>
>> + 1))<br>
>> + EXPECT_TRUE(contains(kAArch64ArchExtKinds,<br>
>> static_cast<unsigned>(AEK))<br>
>> + ? !AArch64::getArchExtName(AEK).empty()<br>
>> + : AArch64::getArchExtName(AEK).empty());<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64ArchExtFeature) {<br>
>> + const char *ArchExt[][4] = {{"crc", "nocrc", "+crc", "-crc"},<br>
>> + {"crypto", "nocrypto", "+crypto",<br>
>> "-crypto"},<br>
>> + {"fp", "nofp", "+fp-armv8", "-fp-armv8"},<br>
>> + {"simd", "nosimd", "+neon", "-neon"},<br>
>> + {"fp16", "nofp16", "+fullfp16",<br>
>> "-fullfp16"},<br>
>> + {"profile", "noprofile", "+spe", "-spe"},<br>
>> + {"ras", "noras", "+ras", "-ras"}};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {<br>
>> + EXPECT_EQ(ArchExt[i][2], AArch64::getArchExtFeature(ArchExt[i][0]));<br>
>> + EXPECT_EQ(ArchExt[i][3], AArch64::getArchExtFeature(ArchExt[i][1]));<br>
>> + }<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64DefaultCPU) {<br>
>> + const char *Arch[] = {"armv8a", "armv8-a", "armv8", "armv8.1a",<br>
>> + "armv8.1-a", "armv8.2a", "armv8.2-a"};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(Arch); i++)<br>
>> + EXPECT_FALSE(AArch64::getDefaultCPU(Arch[i]).empty());<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64parseArch) {<br>
>> + const char *Arch[] = {"armv8", "armv8a", "armv8-a", "armv8.1a",<br>
>> + "armv8.1-a", "armv8.2a", "armv8.2-a"};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(Arch); i++)<br>
>> + EXPECT_NE(static_cast<unsigned>(AArch64::ArchKind::AK_INVALID),<br>
>> + AArch64::parseArch(Arch[i]));<br>
>> + EXPECT_EQ(static_cast<unsigned>(AArch64::ArchKind::AK_INVALID),<br>
>> + AArch64::parseArch("aarch64"));<br>
>> + EXPECT_EQ(static_cast<unsigned>(AArch64::ArchKind::AK_INVALID),<br>
>> + AArch64::parseArch("arm64"));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64parseArchExt) {<br>
>> + const char *ArchExt[] = {"none", "crc", "crypto", "fp",<br>
>> + "simd", "fp16", "profile", "ras"};<br>
>> +<br>
>> + for (unsigned i = 0; i < array_lengthof(ArchExt); i++)<br>
>> + EXPECT_NE(AArch64::AEK_INVALID, AArch64::parseArchExt(ArchExt[i]));<br>
>> +}<br>
>> +<br>
>> +TEST(TargetParserTest, AArch64parseCPUArch) {<br>
>> + const char *CPU[] = {"cortex-a35", "cortex-a53", "cortex-a57",<br>
>> + "cortex-a72", "cortex-a73", "cyclone",<br>
>> + "exynos-m1", "kryo", "vulcan"};<br>
>> +<br>
>> + for (const auto &AArch64CPUName : kAArch64CPUNames)<br>
>> + EXPECT_TRUE(contains(CPU, AArch64CPUName.Name)<br>
>> + ?<br>
>> (static_cast<unsigned>(AArch64::ArchKind::AK_INVALID) !=<br>
>> + AArch64::parseCPUArch(AArch64CPUName.Name))<br>
>> + :<br>
>> (static_cast<unsigned>(AArch64::ArchKind::AK_INVALID) ==<br>
>> + AArch64::parseCPUArch(AArch64CPUName.Name)));<br>
>> +}<br>
>> +}<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
Best Regards,<br>
Jojo<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></blockquote></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div><div class="gmail_extra">-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div>Best Regards,<br></div>Jojo<br></div></div>
</div></blockquote></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Best Regards,<br></div>Jojo<br></div></div>
</div>