<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-cl should support /FAs to emit source code"
href="https://bugs.llvm.org/show_bug.cgi?id=39360">39360</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-cl should support /FAs to emit source code
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sfinae@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>clang-cl supports only /FA to emit assembler, not /FAs which emits assembler
and source code. This significantly increases the difficulty of understanding
Clang codegen.
In the example below, MSVC /FAs prints "return x / 100;".
C:\Temp>type meow.cpp
unsigned long long div100(unsigned long long x) {
return x / 100;
}
C:\Temp>cl /EHsc /nologo /W4 /O2 /c /FAs meow.cpp && type meow.asm
meow.cpp
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.20.26504.99
include listing.inc
INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES
PUBLIC ?div100@@YA_K_K@Z ; div100
; Function compile flags: /Ogtpy
; File C:\Temp\meow.cpp
; COMDAT ?div100@@YA_K_K@Z
_TEXT SEGMENT
x$ = 8
?div100@@YA_K_K@Z PROC ; div100, COMDAT
; 2 : return x / 100;
mov rax, 5165088340638674453 ; 47ae147ae147ae15H
mul rcx
sub rcx, rdx
shr rcx, 1
lea rax, QWORD PTR [rdx+rcx]
shr rax, 6
; 3 : }
ret 0
?div100@@YA_K_K@Z ENDP ; div100
_TEXT ENDS
END
C:\Temp>clang-cl -m64 /EHsc /nologo /W4 /O2 /c /FAs meow.cpp
clang-cl.exe: warning: argument unused during compilation: '/FAs'
[-Wunused-command-line-argument]
C:\Temp>clang-cl -m64 /EHsc /nologo /W4 /O2 /c /FA meow.cpp && type meow.asm
.text
.intel_syntax noprefix
.def "?div100@@YA_K_K@Z";
.scl 2;
.type 32;
.endef
.section .text,"xr",one_only,"?div100@@YA_K_K@Z"
.globl "?div100@@YA_K_K@Z" # -- Begin function ?div100@@YA_K_K@Z
.p2align 4, 0x90
"?div100@@YA_K_K@Z": # @"?div100@@YA_K_K@Z"
# %bb.0:
shr rcx, 2
movabs rdx, 2951479051793528259
mov rax, rcx
mul rdx
shr rdx, 2
mov rax, rdx
ret
# -- End function
.section .drectve,"yn"
.ascii " /DEFAULTLIB:libcmt.lib"
.ascii " /DEFAULTLIB:oldnames.lib"</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>