@@ -77,3 +77,38 @@ pub unsafe fn vs32_clobber() {
7777pub unsafe fn clobber_abi ( ) {
7878 asm ! ( "" , clobber_abi( "C" ) , options( nostack, nomem, preserves_flags) ) ;
7979}
80+
81+ // CHECK-LABEL: @clobber_no_preserves_flags
82+ // CHECK: call void asm sideeffect "nop", ""()
83+ #[ no_mangle]
84+ pub unsafe fn clobber_no_preserves_flags ( ) {
85+ // Use a nop to prevent aliasing of identical functions here.
86+ asm ! ( "nop" , options( nostack, nomem) ) ;
87+ }
88+
89+ // CHECK-LABEL: @cr0_clobber_no_preserves_flags
90+ // CHECK: call void asm sideeffect "nop; nop", "~{cr0}"()
91+ #[ no_mangle]
92+ pub unsafe fn cr0_clobber_no_preserves_flags ( ) {
93+ // Use nop; nop to prevent aliasing of identical functions here.
94+ asm ! ( "nop; nop" , out( "cr0" ) _, options( nostack, nomem) ) ;
95+ }
96+
97+ // CHECK-LABEL: @clobber_preservesflags
98+ // CHECK: call void asm sideeffect "", "~{memory}"()
99+ #[ no_mangle]
100+ pub unsafe fn clobber_preservesflags ( ) {
101+ asm ! ( "" , options( nostack, preserves_flags) ) ;
102+ }
103+
104+ // Output format depends on the availability of altivec and vsx
105+ // CHECK-LABEL: @clobber_abi_no_preserves_flags
106+ #[ no_mangle]
107+ // powerpc: asm sideeffect "nop", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},~{vs0},~{vs1},~{vs2},~{vs3},~{vs4},~{vs5},~{vs6},~{vs7},~{vs8},~{vs9},~{vs10},~{vs11},~{vs12},~{vs13},~{vs14},~{vs15},~{vs16},~{vs17},~{vs18},~{vs19},~{vs20},~{vs21},~{vs22},~{vs23},~{vs24},~{vs25},~{vs26},~{vs27},~{vs28},~{vs29},~{vs30},~{vs31},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer}"()
108+ // powerpc64: asm sideeffect "nop", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{vs0},~{vs1},~{vs2},~{vs3},~{vs4},~{vs5},~{vs6},~{vs7},~{vs8},~{vs9},~{vs10},~{vs11},~{vs12},~{vs13},~{vs14},~{vs15},~{vs16},~{vs17},~{vs18},~{vs19},~{vs20},~{vs21},~{vs22},~{vs23},~{vs24},~{vs25},~{vs26},~{vs27},~{vs28},~{vs29},~{vs30},~{vs31},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer}"()
109+ // powerpc64le: asm sideeffect "nop", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={vs0},={vs1},={vs2},={vs3},={vs4},={vs5},={vs6},={vs7},={vs8},={vs9},={vs10},={vs11},={vs12},={vs13},={vs14},={vs15},={vs16},={vs17},={vs18},={vs19},={vs20},={vs21},={vs22},={vs23},={vs24},={vs25},={vs26},={vs27},={vs28},={vs29},={vs30},={vs31},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer}"()
110+ // aix64: asm sideeffect "nop", "={r0},={r3},={r4},={r5},={r6},={r7},={r8},={r9},={r10},={r11},={r12},={f0},={f1},={f2},={f3},={f4},={f5},={f6},={f7},={f8},={f9},={f10},={f11},={f12},={f13},={vs0},={vs1},={vs2},={vs3},={vs4},={vs5},={vs6},={vs7},={vs8},={vs9},={vs10},={vs11},={vs12},={vs13},={vs14},={vs15},={vs16},={vs17},={vs18},={vs19},={vs20},={vs21},={vs22},={vs23},={vs24},={vs25},={vs26},={vs27},={vs28},={vs29},={vs30},={vs31},={v0},={v1},={v2},={v3},={v4},={v5},={v6},={v7},={v8},={v9},={v10},={v11},={v12},={v13},={v14},={v15},={v16},={v17},={v18},={v19},~{cr0},~{cr1},~{cr5},~{cr6},~{cr7},~{ctr},~{lr},~{xer}"()
111+ pub unsafe fn clobber_abi_no_preserves_flags ( ) {
112+ // Use a nop to prevent aliasing of identical functions here.
113+ asm ! ( "nop" , clobber_abi( "C" ) , options( nostack, nomem) ) ;
114+ }
0 commit comments