void test_fconst(void) {
  double a;
  asm("fld"
      "1"
      : "=t"(a));
  printf("fld"
         "1"
         "= %f\n",
         a);
  ;
  asm("fld"
      "l2t"
      : "=t"(a));
  printf("fld"
         "l2t"
         "= %f\n",
         a);
  ;
  asm("fld"
      "l2e"
      : "=t"(a));
  printf("fld"
         "l2e"
         "= %f\n",
         a);
  ;
  asm("fld"
      "pi"
      : "=t"(a));
  printf("fld"
         "pi"
         "= %f\n",
         a);
  ;
  asm("fld"
      "lg2"
      : "=t"(a));
  printf("fld"
         "lg2"
         "= %f\n",
         a);
  ;
  asm("fld"
      "ln2"
      : "=t"(a));
  printf("fld"
         "ln2"
         "= %f\n",
         a);
  ;
  asm("fld"
      "z"
      : "=t"(a));
  printf("fld"
         "z"
         "= %f\n",
         a);
  ;
}


x86 assembly (clang, -O0):
<test_fconst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fld1
fstpl  -0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xecd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldl2t
fstpl  -0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xeb5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldl2e
fstpl  -0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe9f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldpi
fstpl  -0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldlg2
fstpl  -0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe72(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldln2
fstpl  -0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe5c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldz
fstpl  -0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe46(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fconst>:
sub    $0x38,%rsp
fld1
fstpl  0x30(%rsp)
movsd  0x30(%rsp),%xmm0
lea    0xed9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldl2t
fstpl  0x28(%rsp)
movsd  0x28(%rsp),%xmm0
lea    0xec9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldl2e
fstpl  0x20(%rsp)
movsd  0x20(%rsp),%xmm0
lea    0xebb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldpi
fstpl  0x18(%rsp)
movsd  0x18(%rsp),%xmm0
lea    0xead(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldlg2
fstpl  0x10(%rsp)
movsd  0x10(%rsp),%xmm0
lea    0xe9e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldln2
fstpl  0x8(%rsp)
movsd  0x8(%rsp),%xmm0
lea    0xe90(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
fldz
fstpl  (%rsp)
movsd  (%rsp),%xmm0
lea    0xe84(%rip),%rdi
mov    $0x1,%al
add    $0x38,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"fld1= %f\0A\00"
@.str.1 = [12 x i8] c"fldl2t= %f\0A\00"
@.str.2 = [12 x i8] c"fldl2e= %f\0A\00"
@.str.3 = [11 x i8] c"fldpi= %f\0A\00"
@.str.4 = [12 x i8] c"fldlg2= %f\0A\00"
@.str.5 = [12 x i8] c"fldln2= %f\0A\00"
@.str.6 = [10 x i8] c"fldz= %f\0A\00"
define void @test_fconst() {
%1 = alloca double
%2 = call double asm "fld1", "={st},~{dirflag},~{fpsr},~{flags}"()
store double %2, double* %1
%3 = load double, double* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %3)
%5 = call double asm "fldl2t", "={st},~{dirflag},~{fpsr},~{flags}"()
store double %5, double* %1
%6 = load double, double* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = call double asm "fldl2e", "={st},~{dirflag},~{fpsr},~{flags}"()
store double %8, double* %1
%9 = load double, double* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %9)
%11 = call double asm "fldpi", "={st},~{dirflag},~{fpsr},~{flags}"()
store double %11, double* %1
%12 = load double, double* %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double %12)
%14 = call double asm "fldlg2", "={st},~{dirflag},~{fpsr},~{flags}"()
store double %14, double* %1
%15 = load double, double* %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %15)
%17 = call double asm "fldln2", "={st},~{dirflag},~{fpsr},~{flags}"()
store double %17, double* %1
%18 = load double, double* %1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), double %18)
%20 = call double asm "fldz", "={st},~{dirflag},~{fpsr},~{flags}"()
store double %20, double* %1
%21 = load double, double* %1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %21)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"fld1= %f\0A\00"
@.str.1 = [12 x i8] c"fldl2t= %f\0A\00"
@.str.2 = [12 x i8] c"fldl2e= %f\0A\00"
@.str.3 = [11 x i8] c"fldpi= %f\0A\00"
@.str.4 = [12 x i8] c"fldlg2= %f\0A\00"
@.str.5 = [12 x i8] c"fldln2= %f\0A\00"
@.str.6 = [10 x i8] c"fldz= %f\0A\00"
define void @test_fconst() {
%1 = tail call double asm "fld1", "={st},~{dirflag},~{fpsr},~{flags}"()
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %1)
%3 = tail call double asm "fldl2t", "={st},~{dirflag},~{fpsr},~{flags}"()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %3)
%5 = tail call double asm "fldl2e", "={st},~{dirflag},~{fpsr},~{flags}"()
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), double %5)
%7 = tail call double asm "fldpi", "={st},~{dirflag},~{fpsr},~{flags}"()
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double %7)
%9 = tail call double asm "fldlg2", "={st},~{dirflag},~{fpsr},~{flags}"()
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %9)
%11 = tail call double asm "fldln2", "={st},~{dirflag},~{fpsr},~{flags}"()
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), double %11)
%13 = tail call double asm "fldz", "={st},~{dirflag},~{fpsr},~{flags}"()
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %13)
ret void
}