Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / C / drs / dr094.c
blob132193ba05cbd53ea73864572062edd37c7fdcda
1 /* RUN: %clang_cc1 -std=c89 -emit-llvm -o - %s | FileCheck %s
2 RUN: %clang_cc1 -std=c99 -emit-llvm -o - %s | FileCheck %s
3 RUN: %clang_cc1 -std=c11 -emit-llvm -o - %s | FileCheck %s
4 RUN: %clang_cc1 -std=c17 -emit-llvm -o - %s | FileCheck %s
5 RUN: %clang_cc1 -std=c2x -emit-llvm -o - %s | FileCheck %s
6 */
8 /* WG14 DR094: yes
9 * Are constraints on function return the same as assignment?
12 float func(void) { return 1.0f; }
13 void other_func(void) {
14 int i;
15 float f;
17 /* Test that there's been a conversion from float to int. */
18 i = func();
19 // CHECK: %call = call float @func()
20 // CHECK-NEXT: %conv = fptosi float %call to i32
21 // CHECK-NEXT: store i32 %conv, ptr %i, align 4
23 /* Test that the conversion looks the same as an assignment. */
24 i = f;
25 // CHECK: %0 = load float, ptr %f, align 4
26 // CHECK-NEXT: %conv1 = fptosi float %0 to i32
27 // CHECK-NEXT: store i32 %conv1, ptr %i, align 4